[cs23021] Lab9 question

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Oct 26 21:38:32 EDT 2010


> wouldn't we need to add a setter method for the location class in
> order to deploy each ship?

Function 

  void ship::deployShip(location);

Assigns the location (accepted as parameter) to the ship.
There are two ways to create a location:

  void location::pick(void);  // to be invoked on the object of class
     			      // location

Essentially the above method tells the location to randomly "pick"
itself.

The other method is 

  void location::fire(void):

This method tells the location to input itself from the user. 

Thanks,
--
Mikhail


More information about the cs23021-2 mailing list