In article <1141900843.424145.167110
@u72g2000cwu.googlegroups.com>,
su*****************@gmail.com says...
I defined a pure virtual function like
virtual void sum()=0; <--- pure virtual function
but If I defined a virtual function in a base class in case of
multilevel inheritance for the base pointer to point the right function
with same signature in base and derived class like--
virtual void sum() { }
Now is this a pure virtual function or not and class containing this
function is abstract class or not ?
The second is not a pure virtual function.
The difference between the two is simple. In the first
case, you cannot create an instance of this class. To
create an instance, you must derive from this class, and
the pure virtual function must be overridden in a derived
class.
In the second case, you can create an instance of the
class. A derived class may, but is not required to,
override this virtual function. Instances of the derived
class can be created whether the function has been
overridden or not.
--
Later,
Jerry.
The universe is a figment of its own imagination.