Jump to content

Inheritance/Single: Difference between revisions

m
Line 1,525:
 
=={{header|OCaml}}==
<syntaxhighlight lang="ocaml">class animal =
class animal =
object (self)
(*functions go here...*)
end</syntaxhighlight>
<syntaxhighlight lang="ocaml">class dog =
object (self)
inherit animal
(*functions go here...*)
end</syntaxhighlight>
<syntaxhighlight lang="ocaml">class cat =
object (self)
inherit animal
(*functions go here...*)
end</syntaxhighlight>
<syntaxhighlight lang="ocaml">class lab =
object (self)
inherit dog
(*functions go here...*)
end</syntaxhighlight>
<syntaxhighlight lang="ocaml">class collie =
object (self)
inherit dog
(*functions go here...*)
end</syntaxhighlight>
</syntaxhighlight>
 
=={{header|Odin}}==
7,806

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.