Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

undeclared identifier when using a "getter" method

$
0
0
So i made a simple class that has a member var of type SDL_Rect... I declare it in the default constructor and then try to use a getter that returns the SDL_Rect values (x, y, w, h) but when I do i get the error: Undeclared Identifier...

This variable is declared, but it has been a long day of work and I think I might be missing something simple.

Here is the class:


class Paddle
{
private:
	SDL_Rect dimensions;


public:
	Paddle();

	//getters
	SDL_Rect getDimensions();

	//moving
	void moveRight();
	void moveLeft();
	
};


Paddle::Paddle()
{
	dimensions.x = 0;
	dimensions.y = 0;
	dimensions.w = 150;
	dimensions.h = 40;
}
SDL_Rect getDimensions()
{
	return dimensions;
}


The error occurs on last method getDimensions()

Please help... :)/>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>