• Advertisement
Sign in to follow this  

Using classes as declarers

This topic is 4875 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 made a class A51Color to hold color information. Now, I can use it as a declarer. Ex: A51Color myColor; This will create a variable myColor after A51Color. I later created a A51String class and A51Image class. When I try to used A51String as a declarer in the A51Image class it gives like 20 errors saying it is not a declarer. it is A51Image :: A51Image( int type, A51String file ); I have included it and everything possible i know. Does anyone know another reason why I cannot use A51String as a declarer name. It should work right? NOTE: I do not know if this is true but A51Color is very small in only the .h file but A51String is large and is in .h and .cpp files. Does that make a difference? Thank you

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Impossible to tell from the information you provided, but if I had to take a guess... Maybe you forgot the semicolon at the end of the class declaration, that can lead to some strange error messages sometimes. Your second question I'm not quite sure I understand at all.

Share this post


Link to post
Share on other sites
Yes, I included it and it not that annoying semicolon thing. Here ill put in another way. I have:

// A51Image overloaded constructor
A51Image( int type, A51String file);

This should compile making a Constructor that gets a image type ( the int ) and get a filename, but it give me errors saying the class A51String is not a declarer. Though if i comment (// ... ) out that line the class compiles. I want to know if anyone know why the compiler will not allow my class to act as a declarer? I know it should.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
How about posting the actual error message?

Share this post


Link to post
Share on other sites
x:\...\A51Image.h(27) : error C2062: type 'int' unexpected
x:\...\A51Image.h(27) : error C2238: unexpected token(s) preceding ';'

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Those are the top errors, right? Could be a typo somewhere nearby, before that line. Can't really say without the code in A51Image.h

Share this post


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

  • Advertisement