为什么他们的a =“0”?在方法声明的最后? [英] Why is their a "=0" at the end of the method declaration?

查看:76
本文介绍了为什么他们的a =“0”?在方法声明的最后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在方法声明结束时他们的= 0?



class GamePiece {public:virtual std :: unique_ptr< gamepiece> clone()const = 0; };



我尝试了什么:



为什么他们是方法声明结束时= 0?



类GamePiece {public:virtual std :: unique_ptr< gamepiece> clone()const = 0; };

why is their a "=0" at the end of the method declaration?

class GamePiece { public: virtual std::unique_ptr<gamepiece> clone() const= 0; };

What I have tried:

why is their a "=0" at the end of the method declaration?

class GamePiece { public: virtual std::unique_ptr<gamepiece> clone() const= 0; };

推荐答案

这是一个纯虚函数。如果一个类至少有一个纯虚函数,则它是抽象的。通过在声明中赋值0来声明纯虚函数。阅读更多 C ++中的纯虚函数和抽象类 [ ^ ]
It is a pure virtual function. A class is abstract if it has at least one pure virtual function. A pure virtual function is declared by assigning 0 in declaration. Read more Pure Virtual Functions and Abstract Classes in C++[^]


我昨天告诉你答案,并建议(再次)你不要浪费时间在这里发布问题并实际学习C ++语言。
I told you the answer yesterday, and suggested (yet again) that you stop wasting your time posting questions here and actually studied the C++ language.


这篇关于为什么他们的a =“0”?在方法声明的最后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆