Link to home
Start Free TrialLog in
Avatar of jstephe1
jstephe1

asked on

CObArray with different data types

I'm setting up a CObArray to handle multiple data types.  For instance I have a CLaser class derived from CObject and a CSerial class derived from CObject.  Let's say I place both of these objects into a CObArray object, let's call it m_DeviceArray.  Now I want to populate a list box on screen that will tell me what objects are in the array.  How could I do this?  How could I determine the object type on the fly?  I don't know what the object at element 0 is...or the object at element 5 is...but I want to "dump" the object onto the screen.
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jstephe1
jstephe1

ASKER

Thanks.  Now, to take it a little bit further.  Is there a way to access a data member within that?  For instance, if the CSerial class has a com port variable set to "com2".  Is there a way for me to get that data and place it on screen?
Yes, cast the pointer (CObject *) to CSerial *.
Thanks a lot.