<分区>
:我有以下场景:
// NOTE: pseudo example only, sorry for the early typos
class Foo
{
public:
virtual bool IsItSo();
virtual bool IsItSo(string x);
};
bool Foo::IsItSo()
{
return true;
}
class Bar : Foo
{
public:
// not here
virtual bool IsItSo(string x);
};
bool Bar::IsItSo(string x)
{
return (x == "")
}
class Helper
{
public:
void HelperMethod();
};
void Helper::HelperMethod()
{
Bar *p = new Bar
// ... hack hack hack
bool b = p->IsItSo(); //<-- compilation error
}
我得到的具体错误是:
file.cpp(1124) : error C2660: 'Bar::IsItSo' : function does not take 0 arguments
有人可以向我解释一下这种神奇的疯狂吗?