This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/classvars/SCRIPT
2001-06-06 19:40:57 +00:00

33 lines
659 B
Plaintext

=================================================================
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