On Sat, 27 Sep 2003 20:13:31 +0300, "<- Chameleon ->"
<ch******@hotmail.NOSPAM.com> wrote:
I don't understand. What's the difference in practice between 2 next lines?
When I *must* use first line and when second?
-------------
virtual int a(int b) = 0;
virtual int a(int b);
-------------
thank you
The first line declares a function a in some class that has no
definition - it is there only to be overridden by derived classes for
the purposes of polymorphism. It also makes the class abstract (unable
to be instantiated). Derived classes must declare and implement this
function or else they too are abstract and un-instatiable. It is
useful in defining an interface.
The second line declares a function a in some class that must have an
implementation for that class. That implementation will be inherited
by derived classes but can still be overridden and perform
polymorphically.
S.