c++错误类的语法错误 error c2533:constructors not allowed a return type(构造函数不允许返回一个类型)
Posted 天秤
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c++错误类的语法错误 error c2533:constructors not allowed a return type(构造函数不允许返回一个类型)相关的知识,希望对你有一定的参考价值。
今天编写类的程序的时候不小心把类后的分号忘写了,就出现上面的错误提示。
顺便复习下类的正确格式:
class 类名 { public: //习惯上将公有类型放在前面,便于阅读 ……(外部接口) protected: …… (保护型成员) private: ……(私有成员) }; //这里的分号千万不能忘写,不然会出现错误error: 2533:constructors not allowed a return type
以上是关于c++错误类的语法错误 error c2533:constructors not allowed a return type(构造函数不允许返回一个类型)的主要内容,如果未能解决你的问题,请参考以下文章