关于虚函数问题,急啊
class Time{
public:
virtual bool operator>(Time_12hours& t1){return 0}
virtual bool operator>(Time_24hours& t2){return 0}
virtual bool operator==(Time_12hours& t1){return 0}
virtual bool operator==(Time_24hours& t2){return 0}
virtual bool operator<(Time_12hours& t1){return 0}
virtual bool operator<(Time_24hours& t2){return 0}
virtual void display();
int second;
int minute;
int hour;
};
Time 是基类,Time_12hours和是派生类,Time_24hours是派生类。我想问:1 为什么我拿派生类做参数类型会出错,2 为什么他说我参数太少 3 我想弄成纯虚函数 :如:virtual bool operator>(Time_12hours& t1)=0; 但是会出错。在纯虚函数在基类的声明过后,派生类中需要怎么写这纯虚函数的声明?