Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Refactoring Hidden Constructor and operator=

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
lutherbaker Posted - Sep 05 2007 : 10:42:47 PM
In Visual Studio 2003/2005 (C++) - I can create a class. I hide both the Copy Constructor and operator=(Obj& obj) method by declaring them in the private section - and not implementing them.

For example:

namespace a {

namespace b {

namespace c {

class OldName
{

public:

OldName() { }

private:

OldName(const OldName&);

OldName& operator=(const OldName&);

};

}

}

}




Now, refactor the name of the class by hovering over the "class OldName" section, clicking the arrow and changing the class name.

You will find all the type names change EXCEPT the arguments in the in hidden constructor and operator methods. They remain OldName. Mind you, the name of the copy constructor and return value of the operator=(const OldName&) do indeed change.

Hope that helps,

-Luther


namespace a {

namespace b {

namespace c {

class NewName
{

public:

NewName() { }

private:

NewName(const OldName&);

NewName& operator=(const OldName&);

};

}

}

}
4   L A T E S T    R E P L I E S    (Newest First)
support Posted - Nov 12 2010 : 3:36:21 PM
case=3027 is fixed in build 1836
lutherbaker Posted - Sep 07 2007 : 6:55:49 PM
No problem. Thanks much.

-Luther
feline Posted - Sep 06 2007 : 08:21:36 AM
This is a known bug. VA is confused since there is no parameter name. I know you don't need a parameter name for this to compile, but until this bug is fixed you need to add a parameter name for rename to work correctly. So change the code to read:

        OldName(const OldName&rhs);
        OldName& operator=(const OldName&rhs);


case=3027
tailsu Posted - Sep 06 2007 : 04:31:07 AM
For creating noncopyable classes I'd suggest inheriting from boost::noncopyable from the Boost.Utility library

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000