Inheritance/Single: Difference between revisions

Content added Content deleted
No edit summary
Line 1,582: Line 1,582:


The <tt>.^parents</tt> notation indicates a method call to the object's metaobject rather than to the object itself.
The <tt>.^parents</tt> notation indicates a method call to the object's metaobject rather than to the object itself.

=={{header|Phix}}==
Add (private|public) fields and methods as needed. Make Animal and Dog abstract (ie use "abstract class") to prevent instantiation.
Needs 0.8.1+
<lang Phix>class Animal
private string species
end class
class Dog extends Animal
public procedure bark()
puts(1,"woof\n")
end procedure
end class
class Lab extends Dog end class
class Collie extends Dog end class
class Cat extends Animal end class</lang>


=={{header|PHP}}==
=={{header|PHP}}==