Jump to content
  • Advertisement

Archived

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

nagromo

error in constructor

This topic is 5324 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 writing a simple class that does nothing but initialize its data members for now and it is giving me two errors in the constructor! It is so simple that I have no idea what to do. Here is my code:
//rpg.h


typedef unsigned int u32;

class rpgchar
{
	public:
		rpgchar();
		//void attack(rpgchar *en);

		~rpgchar();
	private:
		u32 ch,mh,cm,mm;
		u32 str,def,spd,dex,wil,mag;
}
//rpg.cpp


#include "rpg.h"

rpgchar::rpgchar()
{                   //errors(line 6)

	mh=ch=25;
	mm=cm=20;
	str=def=spd=dex=wil=mag=15;
}

rpgchar::~rpgchar()
{
	
}
Here are the errors: rpg.cpp:6: error: ISO C++ forbids defining types within return type rpg.cpp:6: error: return type specification for constructor invalid It seems like such simple code! Could someone please notice the obvious and tell me what I''m missing?

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!