Under what circumstances is it advantageous to give an implementation of a pure virtual function?

前端 未结 6 513
礼貌的吻别
礼貌的吻别 2020-12-05 13:37

In C++, it is legal to give an implementation of a pure virtual function:

class C
{
public:
  virtual int f() = 0;
};

int C::f() 
{
  return 0;
}

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 13:59

    Just found out that Herb Sutter answered the first part of this question in his Guru of the Week #31.

提交回复
热议问题