User forums > Using Code::Blocks
Nothing happend when use "->" or "::"
thomas:
--- Quote from: Anonymous ---
-"class X" has virtual function "setA()"
-"class Y" is deride class of "class X" and has virtual function "setB()"
it mean "class Y" must have "setA()" to be a member function of class Y too?
--- End quote ---
If I understand this right, you ask whether a derived class must implement all virtual functions of its ancestor? It does not need to, unless these are pure virtual functions. Although, if these functions do what their name implies, I do not understand why these two functions should be virtual at all.
Maybe you want to read this:
http://www.parashift.com/c++-faq-lite/virtual-functions.html
(also make sure to read 20.7)
This is not a code::blocks issue, however.
Anonymous:
I don't know C::B won't support it, coz VC++ supported. I ask you that if you don't know about all function when your class is a derived class of 3 classes but you know only your new functions of your class, how do you do to remember functions of other 3 classes that are the member of it HAH!. please relax before answer me.
thomas:
--- Quote from: Anonymous on July 23, 2005, 01:26:32 pm ---I don't know C::B won't support it, coz VC++ supported. I ask you that if you don't know about all function when your class is a derived class of 3 classes but you know only your new functions of your class, how do you do to remember functions of other 3 classes that are the member of it HAH!. please relax before answer me.
--- End quote ---
Sorry, I still cannot make head nor tail out of this, although I have read it about 10 times during the last two weeks.
You derive from two (or in the meantime three) classes.
There are some virtual functions in these classes, and your original question was whether you have to implement them.
If the functions are defined like this:
--- Code: ---virtual void SetA(Type parameter) = 0;
--- End code ---
then they are pure virtual, and you must implement them.
If they are defined like this:
--- Code: ---virtual void SetA(Type parameter);
--- End code ---
Then they are just ordinary virtual functions. You can implement them.
--- Quote from: Anonymous on July 23, 2005, 01:26:32 pm ---how do you do to remember functions of other 3 classes that are the member of it HAH!
--- End quote ---
Do you mean something like this?
--- Code: ---class someclass
{
class x {...};
class y {...};
class y {...};
public:
virtual void SetA(...);
...
};
--- End code ---
grv575:
I think he's saying that ancestor virtual functions aren't showing up in descendent codesense completion popups.
rickg22:
Yes, that's a common complaint we've had. Yiannis has to fix that...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version