Original Post
I would think it is possible to overload an base function in an inherited class like so: But when I try to compile this (VS2005) I get an error saying: "Derived::setValue' : function does not take 1 arguments" So am I just not understanding C++ right or what? Or is there some way that I can overload a base function in an inherited class?
class Base
{
public:
void setValue(int v) { value = v; }
protected:
int value;
};
class Derived: public Base
{
public:
void setValue(int v, int i) { value = v; item = i; }
private:
int item;
};
main()
{
Derived d;
d.setValue(10); // this should call the Base::setValue function right?
}