I‘m trying to pass a pointer to an object which class inherits from another class to a function and then access the member functions of it.
This is the base class:
class Base
{
public:
virtual int funcA(int paramA) = 0;
}
This is the derived class:
class Derived : public Base
{
public:
Derived();
~Derived();
int funcA(int paramA);
}
Derived::Derived() {}
Derived::~Derived() {}
Derived::funcA(int paramA)
{
// SOMETHING
}
And the function should look something like this:
template<class T> // T should only be types that are derived from Base
void funcB(T* object)
{
object.funcA(10);
}
I‘ve already tried many different things but none of them compiled because I‘m trying to access a function of a template.