Errors in my game of pong.

Hi, I keep getting the error message "error C2143: syntax error : missing ';' before '.'" I am making a game of pong and honestly have no idea what could be causing this. The code is over 2 .cpp files and 1 .h file (including the main.cpp)

The Ball function is also in a class named Ball.

Calling the function in main.cpp.
 
	Ball.Ball_Paddle_hit();


Declaring the function in the header. (.h file)
 
void Ball_Paddle_hit();


Defining the code in the .cpp.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void Ball::check_win(int p1score, int p2score)
	{
		if (p1score == 5)
		{
			cout << "P1 wins.";
			game_stop();	
		}

		if (p2score == 5)
		{
			cout << "P2 wins.";
			game_stop();	
		}
	}


Any ideas on how to fix this?
Ball is a class name. You cannot use the . operator on a class, you need an instance of the class.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct MyClass
{
    void my_func()
    {
    }
};

int main()
{
    MyClass.my_func(); //incorrect

    MyClass myinstance; //make a new instance
    myinstance.my_func(); //correct
}
Thank you!
Topic archived. No new replies allowed.