#include <iostream>
using namespace std;
class Base
{
public :
virtual void method() = 0;
Base()
{
cout << "Base cons" << endl;
}
~Base()
{
cout << "Base des" << endl;
}
};
class Proxy : public Base
{
private :
Base *pb;
public :
Proxy(Base *t)
{
pb = t;
}
void method()
{
pb->method();
}
};
class Source : public Base
{
public :
void method()
{
cout << "Source" << endl;
}
};
int main()
{
Base *ps = new Source();
Base *pc = new Proxy(ps);
pc->method();
return 0;
}