from [] :

abstract Attribute

An abstract member function must be overridden by a derived class. Only virtual member functions may be declared abstract; non-virtual member functions and free-standing functions cannot be declared abstract.

Classes become abstract if any of its virtual member functions are declared abstract or if they are defined within an abstract attribute. Note that an abstract class may also contain non-virtual member functions.

Classes defined within an abstract attribute or with abstract member functions cannot be instantiated directly. They can only be instantiated as a base class of another, non-abstract, class.

Member functions declared as abstract can still have function bodies. This is so that even though they must be overridden, they can still provide ‘base class functionality’, e.g. through in a derived class. Note that the class is still abstract and cannot be instantiated directly.

Is there thus another way to enforce overriding of given methods? I wish to instantiate superclasses for special instances, as shown in previous mail. It is not a big deal (I can live without this enforcement, and my clients as well since if they wish to implement their own subclasses, they will have to override) but I still wish to know that for further cases.

Thank you,

Reply via email to