37.5.1 Object Creation
- +SomeObject
:: new(
?NewObject)
- NewObject is created with SomeObject as super.
NewObject could be an atom, variable, or compound
term whose arguments are distinct variables.
- +SomeObject
:: new(
?NewObject,
+Supers)
- NewObject is created with Supers specifying the super
objects (prototypes). Supers is a list containing super
specifications. A super specification is either an object identifier or
a pair Object-NotInheritList where NotInheritList
specifies methods not to inherit from Object. NewObject
could be an atom, variable, or compound term whose
arguments are distinct variables.
The object vehicle
is created having the proto-object object
as
super, followed by creating moving_van
with vehicle
as super,
followed by creating truck
.
| ?- object :: new(vehicle),
vehicle :: new(moving_van),
moving_van :: new(truck).
| ?- truck :: super(X), vehicle :: sub(X).
X = moving_van ;
no