I have this code:
struct C
{
int d1;
int d2;
};
struct A
{
void write(C data)
{
}
};
struct B
{
void use(C data)
{
}
};
Now I want to define a new class that uses Aor B, and will call their method writeand use. Something like that:
template <class T>
struct D
{
T t;
D(T myT) { t=myT; }
void myFunct(C data)
{
}
};
As you can see if the two classes have similar method names, it would be easy to implement D, but since Athey Bhave different methods, then I need to tell the compiler which method it should use. How can i do this?
I do not want to change Aeither B, and I also do not want to subclass Aand Bto create a method with the same name.
I need a way to tell the compiler which method to use as part of the template, is this possible?