How do you test an object to see if it has a certain member? Or is there a way to see if an object is an instance of a certain class?
I'm working with an inheritance structure of character-pictures. There are String_Pics, HCat_Pics, VCat_Pics, and and Frame_Pics. They all derive from Pic_Base. The user uses the handle class "Picture" which contains a smart pointer to the objects. Each object stores a pointer to the picture it's based off (a frame of another picture, two picture horizontally concatenated, etc.).
Ex: A Frame-Pic around a VCat-Pic, and both pics in the VCat-Pic are Frame_Pics around String_Pics.
***************
* *
* *********** *
* * This * *
* * is * *
* *********** *
* *********** *
* * The * *
* * Example * *
* *********** *
* *
***************
Frame_Pics have data members for "frame characters," but no other class does. I'm writing a function that will recursively change the frame characters for every frame in the structure. Maybe I'm missing a way to do this otherwise, but I'm looking for a way to test if the object I'm dealing with is a Frame_Pic or not, and thereby whether it would mean anything to try to change the frame characters.
My first instinct was to try something like if (p->frame_char)
where frame_char is the name of one of Frame_Pic's data members, but I don't know how to do this.