Difference between revisions of "Replication"

Line 16: Line 16:
 
<code>[eiffel, N]
 
<code>[eiffel, N]
 
class
 
class
   D
+
   D1
 
inherit {NONE}
 
inherit {NONE}
 
   B
 
   B
Line 25: Line 25:
 
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.

Revision as of 10:19, 25 August 2006


Work in progress!

class
   B
feature
   f: INTEGER
   g is
      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.