Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl inheritance

by Anonymous Monk
on Apr 18, 2014 at 18:44 UTC ( [id://1082804]=note: print w/replies, xml ) Need Help??


in reply to [Resolved]Perl inheritance

However reading online this is different from the stuff I had and the code doesn't print out anything when running and testing it. From what I gathered it's supposed to print "I am a duck" but it does nothing at all.

The code you posted here is not supposed to print anything, it makes no animal objects, it invokes no methods on those objects

Duck->new->speak

Animal->new->speak

Your class Duck inherits from Animal
a Duck is a type of animal
Patka je vrsta Životinje
Patka nasljeđuje od Životinja
http://translate.google.com/translate?sl=auto&tl=hr&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fperldoc.perl.org%2Fperlobj.html&edit-text=&act=url, perlobj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1082804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-23 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found