| Author |
implementing objects in a private class to an array constructor...
|
Johnny Steele
Greenhorn
Joined: Nov 12, 2010
Posts: 12
|
|
hey everyone. So i'm working on my own version of mineSweeper. My professor's explanation, even after several times asking, doesn't seem to quite click with me. In the following code, I have to implement the MineSweeper constructor and my needed instance variable in it. So I've been told the constructor is taking an array of GameSquare objects. My question is: how do I initialize the information within each object if the GameSquare class if Private? Then, how do I call this array later in order to set the my other methods such as isFlagged, click, and so on? Just need a push in the right direction and some clarity, I'm quite confused. Thanks!!! Oh, this method is being implemented in such a way so that I can do some unit testing. There is another constructor using a random number generator but I believe the point of this one is testing.
as you can see I started but have no idea what i''m doing.
-Thank you ahead of time.
|
el Duderino
|
 |
Johnny Steele
Greenhorn
Joined: Nov 12, 2010
Posts: 12
|
|
I found that I had to instantiate all the variables in the private class. Took me a while to figure out!!!
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
We'd even appreciate it if you'd post your solution, so others can learn from your experience.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: implementing objects in a private class to an array constructor...
|
|
|