[英]Inheritance, expected type-specifier before error
Well I'm trying to figure out inheritance in c++, and I'm getting a compile time error error: expected type- specifier before 'Pawn'. 好吧,我试图找出c ++中的继承,我得到一个编译时错误错误:'Pawn'之前的预期类型说明符。 I get this on the following line
我在下面的行中得到了这个
Piece * p = new Pawn(c);
I removed this code because I got worried about people using my code for the assignment I was doing at the time. 我删除了这段代码,因为我担心人们使用我的代码进行我当时所做的任务。 I apologize if this caused any inconvenience, if you have any specific questions contact me.
如果您有任何不便,我深表歉意,如果您有任何具体问题请与我联系。
I'm aware there may be some other errors but This is the one I'm at a loss with. 我知道可能还有其他一些错误,但这是我不知所措。 Thanks in advance for your help!
在此先感谢您的帮助!
In the file that has the statement 在具有该语句的文件中
Piece * p = new Pawn(c);
you seem to forget to include corresponding header files. 你似乎忘了包含相应的头文件。
I had encountered a similar problem. 我遇到过类似的问题。 It turned out I copied and pasted from a previous class and forgot to update my #ifndef statement at the top of my new header file.
事实证明我从上一个类复制并粘贴,忘了更新我的新头文件顶部的#ifndef语句。 The compiler was ignoring my new header file because I told it to.
编译器忽略了我的新头文件,因为我告诉它。 D'oh!
D'哦!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.