Jump to content

  • Log In with Google      Sign In   
  • Create Account


Weird class problems


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   -  Reputation: 782

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!


Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9498

Like
1Likes
Like

Posted 16 March 2013 - 10:58 AM

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

#3 noatom   Members   -  Reputation: 782

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.



PARTNERS