Inheritance/Single: Difference between revisions
Content added Content deleted
m (→{{header|Lisaac}}: 5*s->1) |
m (→{{header|OCaml}}: 5*s->1) |
||
Line 1,525: | Line 1,525: | ||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
<syntaxhighlight lang="ocaml"> |
<syntaxhighlight lang="ocaml"> |
||
class animal = |
|||
object (self) |
object (self) |
||
(*functions go here...*) |
(*functions go here...*) |
||
end |
end |
||
class dog = |
|||
object (self) |
object (self) |
||
inherit animal |
inherit animal |
||
(*functions go here...*) |
(*functions go here...*) |
||
end |
end |
||
class cat = |
|||
object (self) |
object (self) |
||
inherit animal |
inherit animal |
||
(*functions go here...*) |
(*functions go here...*) |
||
end |
end |
||
class lab = |
|||
object (self) |
object (self) |
||
inherit dog |
inherit dog |
||
(*functions go here...*) |
(*functions go here...*) |
||
end |
end |
||
class collie = |
|||
object (self) |
object (self) |
||
inherit dog |
inherit dog |
||
(*functions go here...*) |
(*functions go here...*) |
||
end |
end |
||
</syntaxhighlight> |
|||
=={{header|Odin}}== |
=={{header|Odin}}== |