Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1540: Change Signature should change subclass too

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
drzoom Posted - Oct 31 2006 : 03:54:25 AM
If I change the signature in a superclass, the signature of all overriding methods should change too:


class A {
public:
virtual void foo() = 0;
};
class B : public A {
public:
virtual void foo();
};
class C : public A {
public:
virtual void foo();
};


When I change the signature of the virtual abstract foo() in the superclass. The signatures of the overriding methods in B and C should change too.

8   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Nov 18 2013 : 3:25:19 PM
Change Signature was overhauled in build 2007 and now supports changes in a class hierarchy.
feline Posted - Nov 01 2006 : 07:49:46 AM
I was probably a little hasty in my first response, apologies for that. I have put in a feature request for this, since you do make a sensible argument.

case=3373
drzoom Posted - Nov 01 2006 : 07:24:25 AM
Hm... or in general: Why not let the developer decide, how big the scope of some refactoring methods is?

This is only true for symbols where the scope isn't clear. E.g. member methods. For all other symbols, the scope is IMO clear.

Scope Regions can be any combination of*:

  1. Class: Only the class where the method is declared.

  2. Bases: All bases of the class including multiple inheritance.

  3. Subclasses: All sub, subsub etc. classes of the class where the method is declared.

  4. User: All places where the method is used in the code.



This scope is applicable for "rename" and "signature change".


*=edited after next reply.
drzoom Posted - Nov 01 2006 : 07:13:27 AM
Hm... why not keep the old "change signature" and create a new function "change signature in all classes" ?

I think VAX is like a rocket engine for the software developer. Changing 30+ subclasses "by hand" is slow (and boring). So this is IMO exactly one of this features VAX should support , isn't it?

jpizzi Posted - Oct 31 2006 : 11:12:46 PM
Is it possible to "rename" to a new signature?
feline Posted - Oct 31 2006 : 4:14:29 PM
It is not the number of sub classes, it is more the question "what should Change Signature do?"

Rename scans the sub classes and updates them, but currently Change Signature does not. It makes sense that rename should scan the child classes. I am not so sure that it makes sense for Change Signature to scan the child classes.
drzoom Posted - Oct 31 2006 : 1:04:07 PM
I have this problem not with 2 subclasses. The common situation I have, when I wish to have a such feature, is with 20+ subclasses.

.oO( ok... I guess the answer... use search/replace... )
feline Posted - Oct 31 2006 : 10:26:07 AM
Why should it? I understand what you are saying, but VA has no way of knowing this is what you intend.

I have often used code that looks like this, where the virtual function is overloaded.

I would suggest using Find References in the base class A, which will list all references, allowing you to easily jump to the declaration in both B and C. You can then do the same Change Signature 3 times, one for each class.

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