Review Questions

1:
  1. If Speed is a property defined inside an object called myRocket, what is the general name for the block of statements defined for the Speed property that are executed when the following line is executed?

    myRocket.Speed = 40;
    
  2. When the following line is executed?

    travelTime = distance / myRocket.Speed;
    
2:Which capitalization style is recommended for
  1. Instance variables?

  2. Methods?

  3. Properties?

3:The following lines specify an instance variable declaration and what is meant to be a property with the task of allowing access to the instance variable speed from outside the object. However, the property definition has four problems that need to be fixed before it will work correctly. Find and fix the problems.
 private double speed; private ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.