<b>Capability Classes</b> [1993b37ba2]

Classes whose sole purpose is to allow other classes to be derived from them are know as 'capability classes' - they provide capabilities to their derived classes.

Capability classes generally contain no data but merely specify a number of virtual methods that can be overridden in their derived classes.

The following example builds on the previous example to demonstrate how the <b>Bird</b> class can be better written as a capability class. Its methods no longer contain default output statements but a -1 (error) value if they are called explicitly.

It is necessary to change the return type of thoses methods from <b>void</b> to <b>int</b> and these changes must be reflected in each overriding method in the derived classes.

The base class and each derived class are now contained within their own header file. These are added to the main program with <b>#include</b> directives but it is important to <b>#include</b> the base class before the derived classes to avoid a compiler error.