Logtalk 2.26.2 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1487 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura
2005-12-24 18:07:41 +00:00
parent 9f1b358c04
commit 3455276aa2
55 changed files with 6535 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
:- object(root, % avoid infinite metaclass regression by
instantiates(root)). % making the class its own metaclass
:- public(method/0).
method :-
this(This),
write('This is the default definition for the method, stored in class '),
writeq(This), write('.'), nl.
:- end_object.
:- object(instance1, % this instance simply inherits the method/0 predicate
instantiates(root)).
:- end_object.
:- object(instance2, % this instance provides its own definition for the
instantiates(root)). % method/0 predicate
method :-
this(This),
write('This is an overriding definition stored in the '),
writeq(This),
write(' instance itself.'), nl.
:- end_object.
:- object(instance3, % this instance specializes the inherited definition
instantiates(root)). % of the method/0 predicate
method :-
this(This),
write('This is a specializing definition stored in the '),
writeq(This),
write(' instance itself.'), nl,
write('It makes a super call to execute the default definition:'), nl, nl,
^^method.
:- end_object.