Inheritance/Multiple: Difference between revisions

m
Line 305:
 
=={{header|Eiffel}}==
Having two class—one for CAMERA and the other for a MOBILE_PHONE ...
<lang eiffel >class
CAMERA
Line 311 ⟶ 312:
MOBILE_PHONE
end</lang>
=== Now Multiple Inherit ===
We can create a new CAMERA_PHONE, which inherits directly from both CAMERA and MOBILE_PHONE.
<lang eiffel >class
CAMERA_PHONE
Line 317 ⟶ 320:
MOBILE_PHONE
end</lang>
NOTE: There is no reasonable limit to the number of classes we can inherit from in a single class. The compiler helps us to navigate issues like repeated inheritance and the "diamond of death" easily and quickly.
 
=={{header|Elena}}==
Anonymous user