Introduction to examples

The following classes will be used in various examples:

T, U, V and X, Y, Z

A lot of examples mention types T, U and V or X, Y and Z. If not defined differently, these types are of the following form:

class T end
class U inherit T end
class V inherit U end
 
class X end
class Y inherit X end
class Z inherit Y end

PERSON

For a hierarchy with different endpoints, the person example is used as well:

class PERSON end
class STUDENT inherit PERSON end
class PROFESSOR inherit PERSON end

ANIMAL

Examples involving catcalls use in general the following types:

class ANIMAL
feature
  eat (f: FOOD) do end
  sleep do end
end
 
class CAT inherit ANIMAL 
  redefine eat end
  export {NONE} sleep end
feature
  eat (f: CAT_FOOD) do end
end
 
class DOG
inherit ANIMAL
end
 
class FOOD end
class CAT_FOOD inherit FOOD end

Thus the class CAT covariantly redefines eat and restricts the export status of sleep.

Generics

Generic classes used in examples are the following:

class LIST [G]
feature
  put (g: G) do end
  item: G
  append (other: LIST [G]) do end
end
 
class LINKED_LIST [G] inherit LIST [G] end
class ARRAYED_LIST [G] inherit LIST [G] end
class CELL [G]
feature
  put (g: G) do end
  item: G
end