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
I figured out 2 different meanings for virtual
based on the situation it is being used.
If a
baseClass
has a function definedvirtual
, then thederivedClass
is going to override the function.The
baseClass::~baseClass()
should be definedvirtual
, 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