Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactoring: Renaming a base class

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
xMRi Posted - May 11 2015 : 03:09:27 AM
Let us assume I have a class A derived from class B


class A: public B
{
...
   virtual void SomeFunc();
}; 


void A:SomeFunc()
{
    B:SomeFunc();
}


Now I want to change the base class. Yes this is a rare case. But sometimes you need to get an extra layer in the class hierarchy. And than you need to change the base class.


In my case a dialog was derived from CDialog. But I need CDialogEx...
Finding all locations is tricky. Missing one means that the extra functionality of CDialogEx doesn't get in effect.

But renaming B here is not remaing the classd B. Is is chaning the class name in the class declaration and in the function definition!
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - May 11 2015 : 08:26:02 AM
quote:
But renaming B here is not remaing the classd B. Is is chaning the class name in the class declaration and in the function definition!

Do you mean that if you trigger VA rename from the line

class A: public B

it will not find the class declaration for class B?

When I trigger rename there, it finds and renames all 3 instances of B in the following sample code. But I think I just don't understand your question.

class B {
public:
	virtual void SomeFunc();
};

class A : public B
{
   virtual void SomeFunc();
}; 


void A::SomeFunc()
{
    B::SomeFunc();
}


To change what class "class A" is derived from, you would need to rename at all places when you call the parent. Wouldn't a simple find and replace work? Searching for CDialog:: and replacing with CDialogEx:: and taking a look at all found instances before you proceed with the replace?

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