My objective is to have a "list" of objects of common (abstract) parent
type, but different dynamic type (and each element in the array could
have different behaviour for a call to a particular deferred binding
procedure). The equivalent in a C++ sense would be an array of pointers
to class objects of the same base class, but different derived class.
I'm pretty sre the answer is no, and therefore what I have to do to have
an array of a second type that acts as a wrapper, forwarding any
relevant procedure calls to its single polymorphic component (or ditch
compiler provided arrays altogether and roll my own "list"). Seems like
a bit of a pain in the backside though. Alternative suggestions (or
answering "yes! - you do it this way..." to the initial question) welcomed.
Thanks,
IanH
I don't know about the procedureal end, but the data end of this makes me
think of variant records in Pascal. Each has a tag field which specifies the
actual record layout. If this is no help, then I'm sleepwalking.....
--- e
> Is it possible in F2003 to have an array that has elements with
> different dynamic type at the same time?
No. Type is a property of the array - not of each element separately.
> The equivalent in a C++ sense would be an array of pointers
> to class objects of the same base class, but different derived class.
Well, you also can't have an array of pointers. The usual workaround to
that is...
> I'm pretty sre the answer is no, and therefore what I have to do to have
> an array of a second type that acts as a wrapper,
Yep. That's it.
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain