| roger klaveness wrote, or rather quoted:
(snip)
> For example, given a base class shape, polymorphism enables
> the programmer to define different circumference methods for any
> number of derived classes, such as circles, rectangles and triangles.
> No matter what shape an object is, applying the circumference method
> to it will return the correct results. (snip)...
I think I'm getting the hang of this object-oriented stuff. I can see
the utility of polymorphism: for example, let's define a method
"transpose" which pitch-shifts a note or group of notes by a number of
semitones. This could be made to behave differently depending on which
instrument was called by the score event in question: e.g. one
instrument might expect p4 in oct.pch notation, whereas another might
use p6 in cps. You should only have to specify behavior for each
instrument once, and then our "transpose" method will always take care
of the rest for you...
I'm also liking the idea of being able to give named aliases to pfields.
OK, it's time for me to go bone up on object-oriented concepts and Perl
OOP in particular.
|