[Next] [Previous] [Up] [Top] [Contents] [Index]

2.1 Objects and Inheritance

2.1.1 Inheritance

Objects can inherit from other objects. Informally, this means that the operations defined for parent objects will also apply to child objects. Inheritance in Cecil may be multiple, simply by listing more than one parent object; any ambiguities among methods and/or fields defined on these parents will be reported to the programmer. Inheriting from the same ancestor more than once, either directly or indirectly, has no effect other than to place the ancestor in relation to other ancestors; Cecil has no repeated inheritance as in Eiffel [Meyer 88, Meyer 92]. An object need not have any (explicit) parents; all objects are considered to inherit from the predefined any object (see section 2.1.4). The inheritance graph must be acyclic.

Inheritance in Cecil requires a child to accept all of the fields and methods defined in the parents. These fields and methods may be overridden in the child, but facilities such as excluding fields or methods from the parents or renaming them as part of the inheritance, as found in Eiffel, are not present in Cecil. We have deliberately chosen to experiment with a simpler inheritance semantics.

Finally, it is important to note that inheritance of code is distinct from subtyping ("inheritance" of interface or of specification). Section 3 explains Cecil's support for subtyping and static type checking.


The Cecil Language: Specification and Rationale, Version 2.1 - 25 MARCH 1997
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker