Tuple subclassing
Factor handbook » The language » Objects » Tuples

Prev:Tuple constructors
Next:Tuple slot declarations

Tuple subclassing can be used to express natural relationships between classes at the language level. For example, every car is a vehicle, so if the car class subclasses the vehicle class, it can inherit the slots and methods of vehicle.

To define one tuple class as a subclass of another, use the optional superclass parameter to TUPLE::
TUPLE: subclass < superclass ... ;

Tuple subclassing example
When not to use tuple subclassing

Declaring a tuple class final prohibits other classes from subclassing it:

See also
Calling less-specific methods, Parameterized constructors, Union classes, Mixin classes, Maybe classes