|1:||A class called Robot contains the following two instance variable declarations:|
private ushort age; private bool isConnected;
What is the value of age and isConnected immediately after their object has been instantiated?
Improve the style of the declarations without changing the semantics of the code.
|A1:||age has the value 0 and isConnected the value false.
Improved code would be as follows:
private ushort age = 0; private bool isConnected = false;
|2:||The users of your Robot class would like to assign a value to age at the same time as they are instantiating a Robot object. How would you accommodate for this request?|
|A2:||By equipping the Robot class with the following constructor:
public Robot(ushort ...