Include Paulo Moura's Logtalk OO LP system
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@53 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
32
Logtalk/examples/classvars/SCRIPT
Normal file
32
Logtalk/examples/classvars/SCRIPT
Normal file
@@ -0,0 +1,32 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.8.4
|
||||
|
||||
Copyright (c) 1998-2001 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
% get the value of the class variable for each instance:
|
||||
|
||||
| ?- instance1::cv(Value1), instance2::cv(Value2), instance3::cv(Value3).
|
||||
|
||||
Value1 = 0
|
||||
Value2 = 0
|
||||
Value3 = 0
|
||||
yes
|
||||
|
||||
|
||||
% change the value of the class variable via instance1:
|
||||
|
||||
| ?- instance1::set_cv(1).
|
||||
|
||||
yes
|
||||
|
||||
|
||||
% get the value of the class variable for the other instances:
|
||||
|
||||
| ?- instance2::cv(Value2), instance3::cv(Value3).
|
||||
|
||||
Value2 = 1
|
||||
Value3 = 1
|
||||
yes
|
Reference in New Issue
Block a user