Recognizing Specific Types
Okay, let's imagine this code:
Code:
class CBase {
public:
void my_func (CBase &obj) { }
int data;
};
class CDer_a : public CBase
{
public:
int data;
};
class CDer_b : public CDer_a
{
public:
float data;
};
Now, I have
CBase ObjectA;
CDer_a ObjectB;
CDer_b ObjectC;
within CBase::my_func() how can I tell what "type" is passed? So, if I call CBase::my_func() with ObjectB as a parameter, can I have some sort of if statement in my_func saying "it's of type CDer_a, do this, or no, it's of type CDer_b, do this"?
Something to do with typeid? Thanks in advance.