Inheritance/Single: Difference between revisions
Content deleted Content added
m Got rid of extra whitespace in the tree picture |
added ocaml |
||
Line 70: | Line 70: | ||
//functions go here... |
//functions go here... |
||
}</java> |
}</java> |
||
=={{header|OCaml}}== |
|||
<ocaml>class animal = |
|||
object (self) |
|||
(*functions go here...*) |
|||
end</ocaml> |
|||
<ocaml>class dog = |
|||
object (self) |
|||
inherit animal |
|||
(*functions go here...*) |
|||
end</ocaml> |
|||
<ocaml>class cat = |
|||
object (self) |
|||
inherit animal |
|||
(*functions go here...*) |
|||
end</ocaml> |
|||
<ocaml>class lab = |
|||
object (self) |
|||
inherit dog |
|||
(*functions go here...*) |
|||
end</ocaml> |
|||
<ocaml>class collie = |
|||
object (self) |
|||
inherit dog |
|||
(*functions go here...*) |
|||
end</ocaml> |