locked
operator = overloading RRS feed

  • Question

  • Dear Sir or Madam,

    class dd {

        private:
            int dword = 7;
        public:
            dd& dd::operator=(const int arg)
            {
                return *this;
            }

    };

    dd mydword=9;//ERROR HERE

    I would like to initialize my wrapper over int numbers but 

    overloading in c++ gives error.

    HOW TO DO THIS?

    • Moved by CoolDadTx Tuesday, November 17, 2020 3:25 PM C++ related
    Tuesday, November 17, 2020 1:54 PM

All replies

  • Hello,

    For C++ go to the following forum and post your question with a tag for C++

    https://docs.microsoft.com/en-us/answers/index.html


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Tuesday, November 17, 2020 2:03 PM