Example #1
0
 // add a field to specify an object that ButtonPressed() will first visit
 public PurchaseButton(Economy economy, int index)
 {
     _economy = economy;
     _index   = index;
 }
Example #2
0
 // add a field to specify an object that Button Pressed will visit
 // replace the following default constructor with a constructor that takes
 // an object to be set to the above field
 public CoinReturnButton(Economy economy)
 {
     _economy = economy;
 }
Example #3
0
 // rewrite the following constructor with a constructor that takes an object
 // to be set to the above field
 public CoinInserter(Economy economy, int index)
 {
     _index   = index;
     _economy = economy;
 }