非虚函数声明以=0结尾

Non-virtual function declaration ends with =0

string foo() const = 0;

这个函数声明到底是什么意思?特别是,'=0' 有什么用,因为函数没有声明为虚拟的?

=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