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.
jstephe1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
Call CObject::GetRuntimeClass. Note that this function requires use of the IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL macro in the class implementation.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jstephe1Author Commented:
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?
0
chensuCommented:
Yes, cast the pointer (CObject *) to CSerial *.
0
jstephe1Author Commented:
Thanks a lot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.