|
Revision 4662, 1.5 KB
(checked in by pmoura, 5 days ago)
|
|
Updated copyright notice.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | ================================================================ |
|---|
| 2 | Logtalk - Open source object-oriented logic programming language |
|---|
| 3 | Release 2.35.0 |
|---|
| 4 | |
|---|
| 5 | Copyright (c) 1998-2009 Paulo Moura. All Rights Reserved. |
|---|
| 6 | Logtalk is free software. You can redistribute it and/or modify |
|---|
| 7 | it under the terms of the "Artistic License 2.0" as published by |
|---|
| 8 | The Perl Foundation. Consult the "LICENSE.txt" file for details. |
|---|
| 9 | ================================================================ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | % start by loading the example: |
|---|
| 13 | |
|---|
| 14 | | ?- logtalk_load(engines(loader)). |
|---|
| 15 | ... |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | % both cars provide the same interface, declared in the protocol |
|---|
| 19 | % that is implemented by the categories imported by each object: |
|---|
| 20 | |
|---|
| 21 | | ?- sedan::current_predicate(P). |
|---|
| 22 | |
|---|
| 23 | P = reference/1 ; |
|---|
| 24 | P = capacity/1 ; |
|---|
| 25 | P = cylinders/2 ; |
|---|
| 26 | P = horsepower_rpm/2 ; |
|---|
| 27 | P = bore_stroke/2 ; |
|---|
| 28 | P = fuel/1 |
|---|
| 29 | yes |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | | ?- coupe::current_predicate(P). |
|---|
| 33 | |
|---|
| 34 | P = reference/1 ; |
|---|
| 35 | P = capacity/1 ; |
|---|
| 36 | P = cylinders/2 ; |
|---|
| 37 | P = horsepower_rpm/2 ; |
|---|
| 38 | P = bore_stroke/2 ; |
|---|
| 39 | P = fuel/1 ; |
|---|
| 40 | yes |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | % the sedan engine properties are the ones defined in the corresponding |
|---|
| 44 | % imported category (classic): |
|---|
| 45 | |
|---|
| 46 | | ?- sedan::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)). |
|---|
| 47 | |
|---|
| 48 | Name = 'M180.940' |
|---|
| 49 | Cylinders = 6 |
|---|
| 50 | HP = 94 |
|---|
| 51 | RPM = 4800 |
|---|
| 52 | yes |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | % the coupe engine properties are the ones defined in the corresponding |
|---|
| 56 | % imported category (sport) plus the ones inherited from the top category |
|---|
| 57 | % (classic) which are not overridden: |
|---|
| 58 | |
|---|
| 59 | | ?- coupe::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)). |
|---|
| 60 | |
|---|
| 61 | Name = 'M180.941' |
|---|
| 62 | Cylinders = 6 |
|---|
| 63 | HP = 115 |
|---|
| 64 | RPM = 3657 |
|---|
| 65 | yes |
|---|