What's the difference between virtual function instantiations in C++?

后端 未结 8 1897
栀梦
栀梦 2021-01-25 07:30

What\'s the difference between the following two declarations?

virtual void calculateBase() = 0;  
virtual void calculateBase();

I read the fir

8条回答
  •  清歌不尽
    2021-01-25 07:39

    The first one doesn't have to be implemented in the base class, but enforces it to be implemented in inherited classes.

    You have to implement the second one in the base class and it can be implemented in inherited classes.

提交回复
热议问题