Tuesday, July 14, 2009

C++ comp programming...basic question?

what is wrong here:





class CC


{ public;


void set(int, int);


void print () const;


CC () ;


CC (int, int);


bool CC (int, int);


private:


int u;


int v;


};

C++ comp programming...basic question?
This is a easy one.


Constructors can't have return types.





bool CC (int, int);


CC can't return bool.
Reply:It's useful to learn what your compiler errors mean, and where to look, debugging is one of the most useful skills.





Use a search engine to find what the error your compiler is giving you means, and see if you can work it out from there. It will make programming a whole lot easier in the long run. Of course, ask here as a last resort by all mean.





Looks like a typo, you put the colon after private, but obviously missed shift when typing it after public





public;





should be





public:
Reply:You need a : after public.





class CC


{


public:





void set(int, int);


No comments:

Post a Comment