comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: What about real polymorphism ??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: What about real polymorphism ?? [message #41990 is a reply to message #41984] Thu, 09 December 2004 07:00 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Antonio Santiago writes:

> my problem is with IDL's polymorphism, i think it's a half-polymorphims
> instead real polymorphism.
>
> Supose we have a class Person and two subclasses Man and Woman. Class
> Person has a class called GetInfo() that is overriden in both Man and
> Woman. The question is:
>
> How can i create an array of Person's (that is Man or Woman objects) and
> call the method GetInfo() in the way that depends on the subtype of
> every object it invoques the Man GetInfo() or the Woman GetInfo()??
>
> One possible solution is using OBJ_ISA funtion for every object in the
> array but i want to know if it is possible only with polymorfism in IDL
> like in Java or other OO languages.

I don't understand this question. (Probably I don't
understand what "polymorphism" means, in IDL or anywhere
else, but leave that for a moment.) If you have an array
of mixed man and woman objects, and you call a GetInfo()
method on *any* object, how is it possible NOT to call
the correct method, assuming both man and woman objects
have overwritten the person method? I just can't see
where the problem arises.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stretching an image
Next Topic: ENVI and ROIs

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 20:42:54 PDT 2025

Total time taken to generate the page: 1.04240 seconds