Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why wont this object get created? c++ [duplicate]

Tags:

c++

object

class

Here is my main. All I am trying to do is create an object of the class file, this is probably a very noobish question so sorry, just need to know what I'm doing wrong.

#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();
}
like image 607
Benjamin-Cox Avatar asked Jul 07 '13 11:07

Benjamin-Cox


1 Answers

You declared a function which return Player type, see most vexing parse

To define an object, try update

Player player1();

to

Player player1;
like image 200
billz Avatar answered Oct 11 '22 13:10

billz