The following code is incorrect. Compiler says "The default argument given for parameter 1 in foo"
What's wrong?
Code:class Base{
virtual void foo(string str ="" )=0;
};
class Derived:public Base{
void foo(string str ="" ){}
};
Anther question is that
The compiler says it's not allowed, why is that?Code:void foo(const std::string& str = "")