Let's say we have two classes:
class A:
{
A(int a); // c'tor
virtual ~A(); // d'tor
FirstMethod(...);
SecondMethod(...);
}
class B:public A
{
B(int a); // c'tor
~B(); // d'tor
FirstMethod(...);
SecondMethod(...);
}
The two classes A and B have the exact same methods(same name and parameters but not necessarily the same functionality) and members, except for the destructor's name and the constructor's name, which are different. Now, let's say we have an object:
A* aObject = new A();
and we do:
B* bObject= dynamic_cast<B*>(aObject);
Would the last casting succeed or that bObject will be NULL? or in other words, can the program distinguish between objects that are A* type and objects that are B* type?