Dodo doc > Types > Use as Prototype
A type can be used as prototype, or model, for a new type. The new type inherits the declarations of its prototype and can define new ones. By default the new type also inherits the default value of its parent type as prototype for all of its instances.
Example:
def ExtHouse = new House
{
Colour roofColour
make withWallRoofAndWindows(Colour?, Colour?, Integer?)
}
A declaration in the parent type can be overridden in the new type by giving it a new definition or a new type signature. To indicate that a declaration is overridden, the name of the variable or type should be prefixed with "^". If a variable or function uses the extended identifier syntax the "^" sign should appear before the first single quote.
An overriding attribute declaration should have a
type compatible with the parent, and the parent type should be compatible in return. This usually means the types are identical.
An overriding function declaration should return a
type compatible with the parent return type. The parent parameters type
should be compatible with an overriding
function parameters type. If they are references the overriding
function parameters type should also be compatible with the parent
parameters type, which usually means they are identical.
Examples:
def ^name = "Rita" def ^worldDomination(Robots army, Satellite beamer, Crank crank) -> return(WorldV3) { ... }