class base
{
int a, b;
public:
bool valid();
{
bool ok = false;
if (a > 5 && a < 10 && b > 2 && b < 8)
ok = true;
return ok;
}
};
class derived : public base
{
int a;
public:
bool valid();
{
bool ok = false;
if (a < 8 && a > 15 && // call base's class valid method;
ok = true;
return ok;
}
};
hpw在派生类中调用基类有效方法的有效方法?如何从派生类方法调用基类方法?
查找“范围解析运算符”,又名''''。 –
查看http://stackoverflow.com/questions/357307/c-how-to-call-a-parent-class-function-from-derived-class-function – Matt
a怎么可能小于'8' *和*大于'15'? – 0x499602D2