Hi,
New to this forum.
Will be happy for explanation for the next phenomenon:
class Base
{
protected:
void add(void *);
};
class Derived : public Base
{
public:
void add(int);
}
void Derived::add(int num)
{
add(new int(num));
}
This fails with the message:
Invalid conversion from 'int*' to 'int'
initializing argument 1 of 'void Derived::add(int)'
The following works:
void Derived::add(int num)
{
Base::add(new int(num));
}
Question:
The derived class should have inherited the void add(void*) method from base.
Then, there are two functions with the same name ('add') but different prototypes.
Why the derived doesn't see the "void add(void*)" defined in the Base?
Thank you