Inheritance/Single: Difference between revisions

m
m (→‎{{header|Phix}}: use pygments)
 
(4 intermediate revisions by the same user not shown)
Line 1,730:
{{libheader|Phix/Class}}
Add (private|public) fields and methods as needed. Make Animal and Dog abstract (ie use "abstract class") to prevent instantiation.
<!--(notonline)-->
<syntaxhighlight lang="phix">
without js -- (class)
Line 2,090 ⟶ 2,091:
=={{header|Self}}==
Self is a class-free, object-oriented language, and as such, it uses prototypal inheritance instead of classical inheritance. This is an example of the relevant excerpts from a Self transporter fileout. Normally the object tree would be built and navigated within the graphical Self environment.
<syntaxhighlight lang="self">animal = ()</syntaxhighlight>
animal = ()
<syntaxhighlight lang="self">dog = (| parent* = animal |)</syntaxhighlight>
<syntaxhighlight lang="self">catdog = (| parent* = animal |)</syntaxhighlight>
<syntaxhighlight lang="self">labcat = (| parent* = doganimal |)</syntaxhighlight>
<syntaxhighlight lang="self">collielab = (| parent* = dog |)</syntaxhighlight>
collie = (| parent* = dog |)
</syntaxhighlight>
 
=={{header|Sidef}}==
7,794

edits