root/trunk/examples/classvars/SCRIPT.txt

Revision 4662, 0.9 KB (checked in by pmoura, 6 days ago)

Updated copyright notice.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1================================================================
2Logtalk - Open source object-oriented logic programming language
3Release 2.35.0
4
5Copyright (c) 1998-2009 Paulo Moura.        All Rights Reserved.
6Logtalk is free software.  You can redistribute it and/or modify
7it under the terms of the "Artistic License 2.0" as published by
8The Perl Foundation. Consult the "LICENSE.txt" file for details.
9================================================================
10
11
12% start by loading the example:
13
14| ?- logtalk_load(classvars(loader)).
15...
16
17
18% get the value of the class variable for each instance:
19
20| ?- instance1::cv(Value1), instance2::cv(Value2), instance3::cv(Value3).
21
22Value1 = 0
23Value2 = 0
24Value3 = 0
25yes
26
27
28% change the value of the class variable via instance1:
29
30| ?- instance1::set_cv(1).
31
32yes
33
34
35% get the value of the class variable for the other instances:
36
37| ?- instance2::cv(Value2), instance3::cv(Value3).
38
39Value2 = 1
40Value3 = 1
41yes
Note: See TracBrowser for help on using the browser.