#include <iostream>
using namespace std;
class Base
{
public:
Base()
{
cout << "In Base" << endl;
cout << "This Pointer = " << (int*) this << endl;
cout << endl;
}
virtual void f()
{
cout << "Base::f" << endl;
}
};
class Drive: public Base
{
public:
Drive()
{
cout << "In Drive" << endl;
cout << "This Pointer = " << (int*) this << endl;
cout << endl;
}
virtual void f()
{
cout << "Drive::f" << endl;
}
};
int main()
{
Drive d;
cout << "In Main" << endl;
cout << "In Main = " << (int*) &d << endl;
return 0;
}
In Base
This Pointer = 0xbfffe47c
In Drive
This Pointer = 0xbfffe47c
In Main
In Main = 0xbfffe47c