Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

implementing objects in a private class to an array constructor...

 
Johnny Steele
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
Johnny Steele
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found that I had to instantiate all the variables in the private class. Took me a while to figure out!!!

 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We'd even appreciate it if you'd post your solution, so others can learn from your experience.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic