- Only
abstract
classes can haveabstract
members. - A non-
abstract
class that inherits from anabstract
class mustoverride
itsabstract
members. - An
abstract
member is implicitlyvirtual
. - An
abstract
member cannot provide any implementation (abstract
is calledpure virtual
in some languages). - An
abstract
class cannot be instantiated
The answer is 'implicitly, yes, explicitly, no' - confusing answer, yes? Point 3 above explains it. Any 'abstract' method is, in fact, 'virtual' in that it can be implemented by a deriving class - and in fact, if it is declared 'abstract', it MUST be implemented by a deriving class.
In the case of an Interface:
- No Interface members can provide any implementation
- An implementing class (note that Interfaces are 'implemented', not 'inherited' from) must implement all members of the Interface
No comments:
Post a Comment