|
![](/i/fill.gif) |
Warp wrote:
> Perhaps the best name would be "is_a".
Errr...it's not what type of relation it is...it's what the keyword in OO-POV should
be!
I know it's an "is a"-relation - just sketching on a suggestion for new syntax! :-)
<lots of basic OO theory snipped>
> It is considered bad OO design to inherit from another class only to make
> a "copy" of that class with some modification. For example if I have the
> class IceCream, which describes a chocolate ice cream and then I inherit
> a StrawberryIceCream from it, to make a similar ice cream, but with
> strawberry flavor, that's bad OO design.
> The correct way is to make a (possibly abstract) base class IceCream and
> then inherit different flavored classes from it, eg. ChocolateIceCream and
> StrawberryIceCream. Now there's a true "is a" relation between inherited
> and base classes.
>
> Why do I write all this? Because I didn't like your example:
>
> : #declare worm_part2=like worm_part1{
> : pigment{color rgb 0} // leaves everything like worm_part1, except the pigment.
> : }
>
> You are making a strawberry ice cream from a chocolate ice cream here :)
Of course, I could have made an abstract base (class) object worm_node, and then
inherited worm_part1 and worm_part2 from that object, but as stated before: OO-POV
should not be java (actually, java is already very good at it - being java, i.e.), and
thus it may not need being as OO correct as java is. In the code above, one is saying:
"worm_part2 is like worm_part1, except it has a different pigment" - and I guess many
users would be irritated if they got an error saying "Not strictly correct OO used at
line nnn" while parsing? AND - POV-Ray has always been known for it's flexible and
(rather) forgiving syntax - let's keep it that way.
If one made multiple inheritance possible I could see your point, but that's not going
to happen (if I get to choose) - because THEN we're really talking bad OO design.
> That's not polymorphism, it's dynamic binding.
>
Yep, you're right there...I always seem to regard those two as equivalent, even though
there is a difference. Anyway, if the OO POV language also should incorporate object
methods (you never know), they should of course be allowed to work in a polymorphic
way,
if possible.
----------------------------------------------------
Mikael Carneholm, B.Sc.
Dep. of Computer Science and Business Administration
Personal homepage:
http://www.studenter.hb.se/~arch
E-mail:
sa9### [at] ida utb hb se
Post a reply to this message
|
![](/i/fill.gif) |