Author |
Topic |
|
dreijer
Ketchup Master
62 Posts |
Posted - Jan 03 2008 : 06:43:18 AM
|
Just a quick question regarding the (mostly) awesome Alt+G feature: Say I have a C++ base class and a derived class that overrides one of the base class's methods. I then instantiate an object of the derived class and store it in a pointer to the base class, e.g.:
Bar someBar;
Foo* pFoo = &someBar; // Bar is derived from Foo
Now, say I call the overridden method. If I use the Alt+G feature of VAX on the method call it takes me straight to the base class. Most often, this is NOT what I want since base classes are either abstract or only contain little of the actual implementation. If I use the built-in VS2008 IntelliSense on the overridden method, I get a list of classes that override the method and I can therefore select which one I want. Why don't VAX?
Thanks for a great product. I'm addicted! |
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Jan 03 2008 : 2:08:18 PM
|
Are you calling the method on a variable of the base class type? Or are you calling it on a variable of the derived class type?
In general, without actually compiling and running the program, there is no way to work out what type a pointer to the base class type is actually holding. To a fair degree this is actually the point of virtual methods |
zen is the art of being at one with the two'ness |
|
|
dreijer
Ketchup Master
62 Posts |
Posted - Jan 03 2008 : 3:53:54 PM
|
quote: Originally posted by feline
Are you calling the method on a variable of the base class type? Or are you calling it on a variable of the derived class type?
Yes, I am calling the method on a variable of the base class type. I am fully aware that you cannot deduce the actual type of the pointer at compile-time; what I was merely hinting was that instead of just assuming that I'm interested in the base class (which I rarely am), I should instead be presented with a list of possible classes that implement the base class's methods. I guess I could just use the built-in Go To Definition feature of Visual Studio for now, it's just that I've gotten so used to using Alt+G that I keep forgetting that VAX just blindly jumps to the base class.
|
|
|
willdean
Tomato Guru
134 Posts |
Posted - Jan 04 2008 : 05:30:31 AM
|
Can I add a vote for something in this area, too, though I'm not exactly sure what. As the OP says, the base-class is rarely the place I want to go, and a list of derived-class candidates would be more useful.
|
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Jan 04 2008 : 12:20:49 PM
|
We are considering something like this, perhaps done via a form of Find References. For a larger class hierarchy there may be several implementations of a given virtual function, in different derived classes:
case=6647 |
zen is the art of being at one with the two'ness |
|
|
dreijer
Ketchup Master
62 Posts |
Posted - Jan 06 2008 : 1:09:31 PM
|
Yeah, that's exactly what I was looking for. Cheers! |
|
|
AstaDan
Junior Member
United Kingdom
17 Posts |
Posted - Sep 10 2009 : 09:33:29 AM
|
I too could really use this functionality. I keep having to resort to attempting to use Microsoft's intellisense to go to the definitions of virtual functions. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Sep 10 2009 : 09:44:31 AM
|
For now you might find the Hovering Class Browser, the bottom part of VA View helpful:
http://www.wholetomato.com/products/features/hcb.asp
since this will show you a class and its base classes, allowing you to look for and jump to the desired form of the virtual function. |
zen is the art of being at one with the two'ness |
|
|
AstaDan
Junior Member
United Kingdom
17 Posts |
Posted - Sep 10 2009 : 09:46:20 AM
|
I'll give that a try, thanks. |
|
|
|
Topic |
|