为什么不创建这个对象?C++

Ben*_*Cox 6 c++ class object

这是我的主要内容.我所要做的就是创建一个类文件的对象,这可能是一个非常无聊的问题,很抱歉,只需要知道我做错了什么.

#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();
}
Run Code Online (Sandbox Code Playgroud)

bil*_*llz 12

你声明了一个返回Player类型的函数,看到最烦恼的解析

要定义对象,请尝试更新

Player player1();
Run Code Online (Sandbox Code Playgroud)

Player player1;
Run Code Online (Sandbox Code Playgroud)

  • Downvoter,解释plz (4认同)