Inheritance/Single: Difference between revisions

Content added Content deleted
Line 1,525: Line 1,525:


=={{header|OCaml}}==
=={{header|OCaml}}==
<syntaxhighlight lang="ocaml">class animal =
<syntaxhighlight lang="ocaml">
class animal =
object (self)
object (self)
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end
<syntaxhighlight lang="ocaml">class dog =
class dog =
object (self)
object (self)
inherit animal
inherit animal
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end
<syntaxhighlight lang="ocaml">class cat =
class cat =
object (self)
object (self)
inherit animal
inherit animal
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end
<syntaxhighlight lang="ocaml">class lab =
class lab =
object (self)
object (self)
inherit dog
inherit dog
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end
<syntaxhighlight lang="ocaml">class collie =
class collie =
object (self)
object (self)
inherit dog
inherit dog
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end
</syntaxhighlight>


=={{header|Odin}}==
=={{header|Odin}}==