Á
Á¤Á¤±Õ
hi, all
I have question in method inheritance.
in my opinion, first method call in main function report ambiguity. but
resolves dervied class's method.
thanks in advance.
#include <iostream>
using namespace std;
class Base
{
public:
int f(int b, int c=0)
{
cout<<"Base::f"<<endl;
}
};
class Derivedublic Base
{
public:
int f(int a=0)
{
cout<<"Derived::f"<<endl;
}
};
int main()
{
Derived a;
a.f(0);
a.f(0,1); // c++ reports an error.
}
I have question in method inheritance.
in my opinion, first method call in main function report ambiguity. but
resolves dervied class's method.
thanks in advance.
#include <iostream>
using namespace std;
class Base
{
public:
int f(int b, int c=0)
{
cout<<"Base::f"<<endl;
}
};
class Derivedublic Base
{
public:
int f(int a=0)
{
cout<<"Derived::f"<<endl;
}
};
int main()
{
Derived a;
a.f(0);
a.f(0,1); // c++ reports an error.
}