This is a very basic question, but my C++ skills are a bit rusty...
I have a base class that has a member function that takes 3 arguments, e.g.:
class MyBaseClass
{
public:
int func(int a, char b, int c);
};
and a derived class that overloads that function with a 1-argument version., e.g:
class MyDerivedClass : public MyBaseClass
{
public:
int func(float a);
};
When I try to call the function from the base class on an object of the derived class, like this:
MyDerivedClass d;
d.func(1, 'a', 0);
the compiler complains that MyDerivedClass::func() does not take 3 arguments
. That is true, but shouldn't I be able to access the base class function through an object of the derived class?
What am I doing wrong?