Talk:Polymorphism in object-oriented programming: Difference between revisions

Content deleted Content added
SineBot (talk | contribs)
m Signing comment by Szepi - "Does Perl support polymorphism?: new section"
Line 129:
print $animal->{name} . ': ' . $animal->talk;
}
</source>
 
The major difference to the example given in the article is that we "cast" the objects to the type "Animal" (in the line before the print statement). Also note that additional talk method added to package Animal.
As a result, the output will be:
<blockquote>
Missy: HOW???
Line 138 ⟶ 140:
 
The example demonstrates that Perl '''does not achieve''' dynamic binding through its built-in language constructs. This should be clarified in the text. Probably the same applies to other weakly typed languages (as noted at the beginning of the article).
I propose to remove this example. Alternatively, change it to the above one and explain the issue. Then add an example that demonstrates how in Perl one could implement dynamic binding. {{subst<small><span class="autosigned">—Preceding [[Wikipedia:UnsignedSignatures|1=unsigned]] comment added by [[User:Szepi|2=Szepi]] ([[User talk:Szepi|talk]] • [[Special:Contributions/Szepi|contribs]]) 17:57, 6 February 2010 (UTC)}}</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->