Inheritance/Single: Difference between revisions

m
(→‎{{header|TXR}}: There is OOP now with structs.)
Line 1,269:
=={{header|Perl 6}}==
 
{{works with|Rakudo|2012.062015-09-16}}
<lang perl6>class Animal {}
class Dog is Animal {}
Line 1,276:
class Collie is Dog {}
 
say ~Collie.^parents; # undefined type object
say ~Collie.new.^parents; # instantiated object</lang>
{{out}}
<pre>Dog((Dog) Animal(Animal))
Dog((Dog) Animal(Animal))</pre>
 
The <tt>.^parents</tt> notation indicates a method call to the object's metaobject rather than to the object itself.
Anonymous user