Can you overload a function with the return type?
What is the output of the program below? Why?
Class A
{
public:
void func();
};
class B:pubic A
{
void func(int a);
};
int main()
{
B derv;
derv.func();
}
The output will be a compile error because B doesn't know the definition of func().
To make this program run . Rewrite it as:
Class A
{
public:
void func();
};
class B:pubic A
{
using A::func();
void func(int a);
};
int main()
{
B derv;
derv.func();
}