Difference between revisions of "Replication"

Line 2: Line 2:
  
 
Work in progress!
 
Work in progress!
 +
 +
We start with some very basic examples, for this we consider all the classes not to be inherited by ANY.
 +
 +
== Example set ==
 +
==== Basic cases of direct repeated inheritance ====
 +
 +
The following set of example will base on class B:
  
 
<code>[eiffel, N]
 
<code>[eiffel, N]
Line 8: Line 15:
 
feature
 
feature
 
   f: INTEGER
 
   f: INTEGER
   g is
+
   g
 
       do  
 
       do  
 
         f := f + 1  
 
         f := f + 1  
Line 14: Line 21:
 
end
 
end
 
</code>
 
</code>
 +
 
<code>[eiffel, N]
 
<code>[eiffel, N]
 
class
 
class
Line 25: Line 33:
 
end     
 
end     
 
</code>
 
</code>
 +
  
 
An object of class D1 contains two physical attributes (f_1 and f_2). A call to feature g_1 results in f_1 being incremented and a call to g_2 increments f_2.
 
An object of class D1 contains two physical attributes (f_1 and f_2). A call to feature g_1 results in f_1 being incremented and a call to g_2 increments f_2.

Revision as of 09:20, 25 August 2006


Work in progress!

We start with some very basic examples, for this we consider all the classes not to be inherited by ANY.

Example set

Basic cases of direct repeated inheritance

The following set of example will base on class B:

class
   B
feature
   f: INTEGER
   g
      do 
         f := f + 1 
      end
end
class
   D1
inherit {NONE}
   B
      rename f as f_1, g as g_1 end
   B
      rename f as f_2, g as g_2 end
feature
end


An object of class D1 contains two physical attributes (f_1 and f_2). A call to feature g_1 results in f_1 being incremented and a call to g_2 increments f_2.