我在派生类是抽象的 Dialin 的地方遇到了麻烦。我不确定为什么,因为我拥有的唯一虚函数具有相同的参数和相同的返回类型。根据我的阅读,这是唯一的限制,但显然我错了。
这是我的代码:
标题:
class Event{
class ModemSimV2;
public:
Event( );
Event( const Event &e );
~Event( );
virtual void process( ModemSimV2 &m ) = 0;
protected:
int who; // the number of the user
int time; // when the event will occur
int what; // DIAL_IN or HANGUP
};
class Dialin : public Event{
class ModemSimV2;
public:
Dialin( int name = 0, int tm = 0 );
Dialin( const Dialin &d );
~Dialin( );
virtual void process( ModemSimV2 &m );
private:
int who;
int time;
int what;
};
来源:
Event::Event(){
}
Event::Event( const Event &e ) {
*this = e;
}
Event::~Event( ) {
}
Dialin::Dialin (int name, int tm )
: time( tm ), who( name ) {
return;
}
Dialin::Dialin ( const Dialin &d ) {
*this = d;
}
Dialin::~Dialin( ) {
}
void Dialin::process( ModemSimV2 &m ) {
}