Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Implement virtuals

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

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

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
Alexis Pautrot Posted - Apr 12 2011 : 05:05:56 AM
It should be helpful to have an action named "Implement virtuals", available on a right click on a class inheritance declaration ( class A : public B, public C ) that allow to implement virtual methods of inherited classes. This feature should open a checklistbox to ask which method to override, then implements them in the class.
11   L A T E S T    R E P L I E S    (Newest First)
support Posted - Aug 09 2012 : 01:49:17 AM
case=52138 is implemented in build 1912
feline Posted - Aug 05 2011 : 2:08:56 PM
Some of the refactoring snippets are re-used for a few different commands, so it is often worth having a look at the snippets, to see if any of them are being used
tlesher Posted - Aug 05 2011 : 1:46:31 PM
Originally posted by feline

The method body comes from the VA Snippet "Refactor Create From Usage Method Body".

Ahh, I didn't make that connection when I was looking for the snippet, so I thought it was internally defined.

feline Posted - Aug 05 2011 : 1:42:51 PM
The method body comes from the VA Snippet "Refactor Create From Usage Method Body". So just edit this snippet to change the exception string:

tlesher Posted - Aug 05 2011 : 11:21:25 AM
Great feature.

One suggestion: right now, the body of the function looks like this:

void MyClass::MyFunction()
    throw std::exception("The method or operation is not implemented.");

When doing TDD or other incremental development, it's not uncommon for this exception to actually get thrown in a test run (until the method actually gets implemented). It would be more useful if the body looked like this:

void MyClass::MyFunction()
    throw std::exception(__FUNCTION__ " is not implemented.");

Most unit test libraries will print the what() of the exception thrown, which helps when a method that you didn't think should be getting called yet really is.
support Posted - Jul 20 2011 : 02:06:27 AM
Maintaining declaration order in Implement Interface is case=58301, and is fixed in build 1854.
feline Posted - May 13 2011 : 5:25:29 PM
Are you seeing this ordering problem when using system / library classes as your base class, or only when using your own classes as the base class?

I have tried the following, very simple, test here, and the ordering of the implemented functions is the same as the ordering in the two base classes:

class testInterfaceBaseOrderOne
	virtual void BaseOneMember1();
	virtual void BaseOneMember2();
	virtual void BaseOneMember3();
	virtual void BaseOneMember4();

class testInterfaceBaseOrderTwo
	virtual void BaseTwoMember1();
	virtual void BaseTwoMember2();
	virtual void BaseTwoMember3();
	virtual void BaseTwoMember4();

class testInterfaceOrderCreated : public testInterfaceBaseOrderOne, testInterfaceBaseOrderTwo

So I am wondering what is triggering this random ordering of new functions. Does the order of the functions in the dialog seem to be related to the order of the functions as implemented in the header file?

The documentation for VA Outline is here, in case you are interested:

gerol80 Posted - May 13 2011 : 07:20:03 AM
Hi feline,

thanks for your answer. I'd expect the order to be the same as in the header file of the interface I'm implementing. If a class implements several interfaces, you could add comments to separate the methods, e.g.

// Methods from Interface1.h


// Methods from Interface2.h


and so on.

I was not aware of this VA outline functionality. I will try this, thanks!
feline Posted - May 12 2011 : 2:23:39 PM
Point 2, we are working to enhance this command so that it will scan more than one base class deep:


This has always been the plan, but it brings its own set of edge cases with it.

Point 1, for the header file, do you have a preference / expectation of the ordering of items? It is complicated by the need to try and respect the visibility of each of the virtual methods.

For the placement into the cpp file, this is something we are looking at, but since the .h and cpp files are often very differently ordered to begin with, it is a little tricky.

Are you aware you can use VA Outline to drag and drop items, to reorder both the .h and the cpp file?
gerol80 Posted - May 12 2011 : 08:08:32 AM
Hi everybody,

unfortunately this "Implement Interface" command has some drawbacks IMHO:

1. The order of the methods is totally random G?? in the header and the cpp file. It's neither the original order from the interface header nor is it any observable order at all (e.g. alphabetical).

2. It only implements methods from a direct base interface.
You have an interface IThing. You have another interface IMoreSpecificThing which implements IThing. If you now write a class that implements IMoreSpecificThing and use the "Implement Interface" command, it only implements the methods from IMoreSpecificThing, not the ones from IThing.

Will this command be improved in later releases?
feline Posted - Apr 12 2011 : 10:54:42 AM
Are you aware of the new Implement Interface refactoring command? This is designed to help in exactly this type of situation.

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