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

4.1 Explicit Parameterization

4.1.3 Parameterized Objects and Types

It is not possible to inherit directly from a parameterized object representation, nor to subtype directly from a parameterized type. However, it is possible (and common) to inherit from an instantiation of a parameterized object and to subtype from an instantiation of a parameterized type. A particularly common idiom is for a parameterized object or type to inherit or subtype from another parameterized object or type instantiated with (some function of) the first parameterized object or type's type parameters. For example:

abstract object collection[T];
abstract object table[Key,Value] isa collection[Value];
template object array[T] isa table[int,T];
type printable_array[T <= printable] subtypes array[T], printable;

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

Generated with Harlequin WebMaker