Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的主要内容。我要做的就是创建一个类文件的对象,这可能是一个非常愚蠢的问题,很抱歉,只需要知道我做错了什么。
#include <iostream> #include "Player.h" using std::cout; using std::cin; int main() { cout << "Hello and welcome to the student adventures game.\n"; Player player1(); }
您声明了一个返回 Player 类型的函数,请参阅最令人烦恼的解析
要定义一个对象,请尝试更新
Player player1();
至
Player player1;
声明不带参数的对象时不应使用括号,否则编译器会认为您声明的是返回 aPlayer且不带参数的函数。
Player