9fc2c47d53
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1908 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
39 lines
754 B
Plaintext
39 lines
754 B
Plaintext
================================================================
|
|
Logtalk - Open source object-oriented logic programming language
|
|
Release 2.30.2
|
|
|
|
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
|
================================================================
|
|
|
|
|
|
% start by loading the example:
|
|
|
|
| ?- logtalk_load(classvars(loader)).
|
|
...
|
|
|
|
|
|
% 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
|