virtual keyword in different scenarios

Posted by Mahesh on Stack Overflow See other posts from Stack Overflow or by Mahesh
Published on 2011-01-07T05:45:44Z Indexed on 2011/01/07 5:53 UTC
Read the original article Hit count: 261

Filed under:
|

I figured out 2 different meanings for virtual based on the situation it is being used.

  • If a baseClass has a function defined virtual, then the derivedClass is going to override the function.

  • The baseClass::~baseClass() should be defined virtual, if there is any class derived from it. Here it means, the derived class destruction first takes place followed by base class destruction.

Are there any other situations where virtual hold a different meaning ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about virtual