#include using namespace std; class B{}; class D : public B {}; void main() { B b; D d; B* pb; D* pd; pb = &b; //works pb = &d; //works pd = &d; //works //pd = &b; // will never work (a derived class pointer can not point to a base class object) pb = pd; //works without a typecast pd = (D*)pb; //works only with a typecast //d = b; //the = operator would have to be overloaded to make this work b = d; //this works without a typecast }