Changeset 4508 for trunk/examples/complements/complements.lgt
- Timestamp:
- 10/15/08 17:36:18 (3 months ago)
- Files:
-
- 1 modified
-
trunk/examples/complements/complements.lgt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/complements/complements.lgt
r4274 r4508 1 1 2 % setup the object employee as a monitor for any message sent to itself: 2 3 :- initialization(define_events(before, employee, _, _, employee)). 3 4 … … 15 16 16 17 :- category(logging, 17 implements(monitoring), 18 complements(employee)). 18 implements(monitoring), % built-in protocol for event handler methods 19 complements(employee)). % add the category predicates to the employee object 19 20 21 % define a "before" event handler for the complemented object: 20 22 before(_, Message, Sender) :- 21 23 write('Received message '), writeq(Message), write(' from '), writeq(Sender), nl. 22 24 23 % add a new method to the object: 24 25 % add a new method to the complemented object: 25 26 :- public(predicates/1). 26 27
