This class when, it is not integrated with the main program, shows the following error....and I have no idea what it is trying to say.. :( :(

#include "character.h"

Character::Character(DrawEngine *de, int s_index, float x, float y, 
					 int lives, char up_key, char down_key, char left_key, char right_key) 
					 : Sprite(de, s_index, x, y, lives)
{
	upKey = up_key;
	downKey = down_key;
	leftKey = left_key;
	downKey = right_key;

	classID = CHARACTER_CLASSID;
}

bool Character::keyPress(char c)
{
	if(c == upKey)
		return move(0,-1); //move method is returning true
	else if(c == downKey)
		return move(0, 1);
	else if(c == rightKey)
		return move(1, 0);
	else if(c == downKey)
		return move(-1, 0);

	return false;
}

[Error]
error C2533: 'Character::{ctor}' : constructors not allowed a return type

can anyone enlighten me...

N.B. when i make use of this class, it creates a lots of error.I am sure the implementation and other things are ok.

Project File is attached.There are two of them, one using this class and the other is not using.Their difference is minor.

Check your "character.h" and see if you have a semicolon after the class declaration (I didn't download your project).

Please post 'character.h'. I suspect something like this:

void Character::Character();

when it should be simply:

Character::Character();

Dave

Line 19 of "character.h" you need to add a semi-colon. Class definitions must always be followed with a semi-colon. The rest of your classes and all your constructors look okay.

..thanks....

pathetic mistake...

dont know how it got away so easily.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.