Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Weird class problems

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 noatom   Members   

925
Like
0Likes
Like

Posted 16 March 2013 - 10:46 AM

Here is my code,don't ask about the stupid class names,it's from an exercise.

 

the header:

  


class Hen{

public:
	
	class Nest{
		int go;
		public:
		friend Hen;
	
		class Egg{
			int a;
		public:

			friend Nest;
			friend Hen;
		};
	};
	int test(Hen::Nest::Egg *xa);
}

 

the cpp file
 



#include "chesire.h"

int test(Hen::Nest::Egg *xa){
return 1;
}

 

 

 

There are the errors:

 

error C2628: 'Hen' followed by 'int' is illegal (did you forget a ';'?)
error C3874: return type of 'main' should be 'int' instead of 'Hen'
1>  chesire.cpp
error C2628: 'Hen' followed by 'int' is illegal (did you forget a ';'?)
error C2440: 'return' : cannot convert from 'int' to 'Hen'
 
 
What is wrong here? I can't find 1 single thing wrong with the function!


#2 SiCrane   Moderators   

11763
Like
1Likes
Like

Posted 16 March 2013 - 10:58 AM

You're missing a ; at the end of your class definition.

#3 noatom   Members   

925
Like
0Likes
Like

Posted 16 March 2013 - 11:22 AM

damn! i spent almost an hour on this thing!...thanks a lot






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.