So say I have a class A:
class A{
public:
void DoSomething();
void DoSomethingElse(int x);
};
And I want to have another class Proxy:
class Proxy{
A* a;
public:
void DoSomething(){ a->DoSomething(); }
void DoSomethingElse(int x){ a->DoSomethingElse(x); }
};
But the hitch is that I want to be able to make Proxy
a templated class so that I can do this kind of transform to any class....
Is there some sort of trick I can do?
A detailed description:
Basically this proxy would take every single method in the class and create a method with the same name and use the pointer to complete the method....You cannot use inheritance because that increases the size, which is actually what I am trying to avoid here.
I am basically asking is there something akin to overriding the dot operator like in this question: Why can't you overload the '.' operator in C++? (The answer in there was "no")