Inheritance/Multiple: Difference between revisions
Content deleted Content added
Line 305: | Line 305: | ||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |
||
Having two class—one for CAMERA and the other for a MOBILE_PHONE ... |
|||
<lang eiffel >class |
<lang eiffel >class |
||
CAMERA |
CAMERA |
||
Line 311: | Line 312: | ||
MOBILE_PHONE |
MOBILE_PHONE |
||
end</lang> |
end</lang> |
||
=== Now Multiple Inherit === |
|||
We can create a new CAMERA_PHONE, which inherits directly from both CAMERA and MOBILE_PHONE. |
|||
<lang eiffel >class |
<lang eiffel >class |
||
CAMERA_PHONE |
CAMERA_PHONE |
||
Line 317: | Line 320: | ||
MOBILE_PHONE |
MOBILE_PHONE |
||
end</lang> |
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}}== |
=={{header|Elena}}== |