• Advertisement

Archived

This topic is now archived and is closed to further replies.

Help, im stuck! =/

This topic is 5061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am getting error C2533: ''Ball::__ctor'' : constructors not allowed a return type, when it doesnt have one. Here''s the code. Header file:
#ifndef _BALL_
#define _BALL_

class Ball {
private:
	int x_velocity;
	int y_velocity;
public:
	Ball();
	~Ball();

	void BounceX();
	void BounceY();
}

#endif
And the source:
#include "Ball.h"

//Default constructor

Ball::Ball() {
	x_velocity = 1;
	y_velocity = 1;
}

//Destructor

Ball::~Ball() {

}

void Ball::BounceX() {
	x_velocity *= -1;
}

void Ball::BounceY() {
	y_velocity *= -1;
}

Share this post


Link to post
Share on other sites
Advertisement
You forgot the semi-colon at the end of your class declaration in your header file.

Share this post


Link to post
Share on other sites
I believe it may be because there isn't a semi-colon at the end of your class decleration. I haven' ttested it though. Try it and see if it works.

Edit: Looks SiCrane beat me to it

[edited by - cilcoder on April 11, 2004 2:05:54 AM]

Share this post


Link to post
Share on other sites
Yep, the semicolon did it. Can''t believe I missed that! Which is why it''s good to have other people look at the code. Thanks for pointing out such a stupid mistake on my part, hehe

Share this post


Link to post
Share on other sites

  • Advertisement