Inheritance/Multiple: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 469: Line 469:
}</lang>
}</lang>


=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64

' FB does not currently support multiple inheritance. Composition has to be used instead if one wants
' to (effectively) inherit from more than one class. In some cases, this might arguably be a better
' solution anyway.

Type Camera Extends Object ' if virtual methods etc needed
' ...
End Type

Type Phone Extends Object
' ...
End Type

Type CameraPhone Extends Phone ' single inheritance
cam As Camera ' using composition here
' other stuff
End Type</lang>


=={{header|Forth}}==
=={{header|Forth}}==
Line 533: Line 514:
camera phone
camera phone
</lang>
</lang>

=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64

' FB does not currently support multiple inheritance. Composition has to be used instead if one wants
' to (effectively) inherit from more than one class. In some cases, this might arguably be a better
' solution anyway.

Type Camera Extends Object ' if virtual methods etc needed
' ...
End Type

Type Phone Extends Object
' ...
End Type

Type CameraPhone Extends Phone ' single inheritance
cam As Camera ' using composition here
' other stuff
End Type</lang>


=={{header|Go}}==
=={{header|Go}}==