Original Post
Hi All, I'm playing with some Java tetris code from Nathan Williams of MIT (http://www.mit.edu/people/nathanw/) and am trying to implement his Java classes in C++. The source can be found at http://www.mit.edu/people/nathanw/java/TetrisSrc.html On line 7 of TetrisPiece.java there is the member array pieces which is used to initialise instances of the Grid class with common Grid configurations ie tetris shapes. static Grid pieces[]= new Grid[7]; What I'm not sure of, is how to declare my own static array of Grid objects in C++. What I have done is break it up into the header which containts the class declaration: static Grid pieces[7]; and the cpp which has the code: Grid TetrisPieces::pieces[] = { Grid(3,3), Grid(2,2), Grid(3,3), Grid(3,3), Grid(3,3), Grid(3,3), Grid(3,4) }; This compiles fine but I can't initialise the grid ie a call to: Grid TetrisPieces::pieces[0].mGrid[0][0] = 0; will result in the compile error C2466: cannot allocate an array of constant size 0 Any ideas on the cleanest way to implement this Java code in C++? Cheers, Graham