How can Derived class inherit a static function from Base class?

前端 未结 3 1260
旧巷少年郎
旧巷少年郎 2020-12-08 15:02
struct TimerEvent
{
   event Event;
   timeval TimeOut;
   static void HandleTimer(int Fd, short Event, void *Arg);
};

HandleTimer needs to be stat

3条回答
  •  自闭症患者
    2020-12-08 15:35

    You've got a bit of a conflict here in your question. When you pass &TimerEvent::TimerHandler to a C library, you do exactly that. You could also have passed &DerivedTimerEvent::TimerHandler, if you wanted. But you can't pass &TimerEvent::TimerHandler and expect the C library (!) to figure out you actually meant &DerivedTimerEvent::TimerHandler.

提交回复
热议问题