Changeset 4590 for trunk/examples
- Timestamp:
- 11/13/08 07:50:36 (8 weeks ago)
- Location:
- trunk/examples
- Files:
-
- 2 modified
-
classmethods/NOTES.txt (modified) (1 diff)
-
people/people.lgt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/classmethods/NOTES.txt
r4572 r4590 13 13 14 14 This example illustrates how to define "class methods" as found on class- 15 based object-oriented programming such as Java or Objective-C. Logtalk16 classes are objects. Therefore, class methods are simply instance methods 17 defined in the class of the class, i.e. in its meta-class.15 based object-oriented programming languages such as Java or Objective-C. 16 Logtalk classes are objects. Therefore, class methods are simply instance 17 methods defined in the class of the class, i.e. in its meta-class. 18 18 19 19 This example defines the following objects: -
trunk/examples/people/people.lgt
r4501 r4590 34 34 self(Self), 35 35 create_object(Person, [extends(Self)], [], []), 36 Person:: name(Name),37 Person:: birth(Birth).36 Person::assertz(name(Name)), 37 Person::assertz(birth(Birth)). 38 38 */ 39 39 … … 72 72 73 73 new(Person, Name, Birth, Office) :- 74 ::new(Person, Name, Birth), 75 Person::assertz(office(Office)). 74 ::new(Person, Name, Birth), % create a "generic" person and 75 Person::assertz(office(Office)). % add "teacher" specific data 76 76 77 77 print :- … … 104 104 105 105 new(Person, Name, Birth, Dorm) :- 106 ::new(Person, Name, Birth), 107 Person::assertz(dorm(Dorm)). 106 ::new(Person, Name, Birth), % create a "generic" person and 107 Person::assertz(dorm(Dorm)). % add "student" specific data 108 108 109 109 print :-
