What could possibly cause this error when declaring an object inside a class?

Posted by M4design on Stack Overflow See other posts from Stack Overflow or by M4design
Published on 2010-05-22T06:21:50Z Indexed on 2010/05/22 6:40 UTC
Read the original article Hit count: 232

Filed under:
|
|

I'm battling with this assignment :)

I've got two classes: Ocean and Grid.

When I declare an object of the Grid inside the Ocean:

unsigned int sharkCount;
Grid grid;

The compiler/complainer says:

error C2146: syntax error : missing ';' before identifier 'grid'


Can you possibly predict what produces this error with the limited info I provided?

It seems that as if the Ocean doesn't like the Grid class. Could this be because of the poor implementation of the grid class. BTW the Grid has a default constructor.

Yet the error happens in compiling time!.

EDIT: They're each in separate header file, and I've included the Grid.h in the Ocean.h.

© Stack Overflow or respective owner

Related posts about c++

Related posts about object-oriented