• Advertisement
Sign in to follow this  

Weird class problems

This topic is 1768 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

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!

Share this post


Link to post
Share on other sites
Advertisement
You're missing a ; at the end of your class definition.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement