非虚函数声明以= 0结尾

时间:2015-04-05 20:29:38

标签: c++ syntax

string foo() const = 0;

这个函数声明究竟是什么意思?特别是什么是' = 0'好的,因为函数未被声明为虚拟?

1 个答案:

答案 0 :(得分:3)

= 0是该函数是纯虚函数的语法。据我所知,声明还需要在关键字virtual之前。

更多关于此的内容:What does it mean to set the declaration of a function equal to 0? How can you assign an integer to a function?

Difference between a virtual function and a pure virtual function