develooper Front page | perl.perl5.porters | Postings from April 2011

Re: Revising Perl's OO docs - a new OO tutorial

Thread Previous | Thread Next
From:
nikosv
Date:
April 20, 2011 01:31
Subject:
Re: Revising Perl's OO docs - a new OO tutorial
Message ID:
ddeb6e58-96f8-4d3c-a78e-949a794f8970@r23g2000vbp.googlegroups.com
I liked the tutorial and the coverage of the OOP concepts applied to
Perl, altough I have a question.
when you say :
"Polymorphism is a fancy way of saying that objects from two different
classes share an API. For example, we could have Person and Animal
classes which both have a speak() method. This method might produce
different output for each class, but the basic API is the same.
While the two classes may differ in many ways, when it comes to the
speak() method, they are the same. This means that we can try to call
the speak() method on an object of either class, and we don't have to
know what class the object belongs to!"
it looks to me that this part resembles Interface inheritance, as in
Java/C#, since the Person and Animal classes look unrelated and don't
have a common parent.should it have been moved to the Roles section?
Also the "Overriding methods and method resolution" is an example of
Polymorphism but the term is not mentioned there

thanks


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About