git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1580 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
		
			
				
	
	
		
			63 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| =================================================================
 | |
| Logtalk - Object oriented extension to Prolog
 | |
| Release 2.27.1
 | |
| 
 | |
| Copyright (c) 1998-2006 Paulo Moura.  All Rights Reserved.
 | |
| =================================================================
 | |
| 
 | |
| 
 | |
| % start by loading the example:
 | |
| 
 | |
| | ?- logtalk_load(engines(loader)).
 | |
| ...
 | |
| 
 | |
| 
 | |
| % both cars provide the same interface, declared in the protocol
 | |
| % that is implemented by the categories imported by each object:
 | |
| 
 | |
| | ?- sedan::current_predicate(P).
 | |
| 
 | |
| P = reference/1 ;
 | |
| P = capacity/1 ;
 | |
| P = cylinders/2 ;
 | |
| P = horsepower_rpm/2 ;
 | |
| P = bore_stroke/2 ;
 | |
| P = fuel/1
 | |
| yes
 | |
| 
 | |
| 
 | |
| | ?- coupe::current_predicate(P).
 | |
| 
 | |
| P = reference/1 ;
 | |
| P = capacity/1 ;
 | |
| P = cylinders/2 ;
 | |
| P = horsepower_rpm/2 ;
 | |
| P = bore_stroke/2 ;
 | |
| P = fuel/1 ;
 | |
| yes
 | |
| 
 | |
| 
 | |
| % the sedan engine properties are the ones defined in the corresponding 
 | |
| % imported category (classic):
 | |
| 
 | |
| | ?- sedan::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)).
 | |
| 
 | |
| Name = 'M180.940'
 | |
| Cylinders = 6
 | |
| HP = 94
 | |
| RPM = 4800 
 | |
| yes
 | |
| 
 | |
| 
 | |
| % the coupe engine properties are the ones defined in the corresponding 
 | |
| % imported category (sport) plus the ones inherited from the top category 
 | |
| % (classic) which are not overridden:
 | |
| 
 | |
| | ?- coupe::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)).
 | |
| 
 | |
| Name = 'M180.941'
 | |
| Cylinders = 6
 | |
| HP = 110
 | |
| RPM = 5000 
 | |
| yes
 |