| Re: What about real polymorphism ?? [message #41963 is a reply to message #41962] |
Thu, 09 December 2004 15:22   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mark Hadfield writes:
> I think Antonio's confusion came from his experience with languages like
> C++ and Java, which have a different object model from IDL. In C++ and
> Java, the fact that two classes have a method called Draw does not imply
> these methods are related. For them to be related, the classes have to
> have a common superclass which itself has a Draw method. The
> superclass's Draw method will often be virtual, ie. not implemented, but
> it has to exist.
>
> Then if you want to put objects of different classes in a container,
> they all have to share a common superclass and when you put them into
> the container they kind-of-lose their identity (sorry for the technical
> terms here) So when you take an object back you have to cast it back its
> superclass before you can call its Draw method.
Ahhh.
> I hope nobody who knows anything about C++ and/or Java is reading this!
No chance of that, I don't think.
>> So, in Antonio's case, if he wants to treat his MEN
>> and WOMEN objects as "people", the more power to him.
>> Anyone who interacts with one of his "people" is going
>> to find the proper method called without him having to
>> do anything extra about it. That seems like perfect
>> polymorphism to me. :-)
>
> Me too, but the strictly-typed people find it all a bit vague & scary.
Then what are they doing fooling around with IDL, which
is loose and messy and often inconsistent!? You've got
to embrace chaos to hang around here long. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|