Object-oriented programming

Your assignment is to explore the capabilities of C++ for capturing real-world relationships between objects in the constructs of the language. There are two objects in the problem:

  1. an astronomical telescope, which can be positioned in two axes: azimuth and elevation.
  2. a dome which houses the telescope and whose shutter opening must track the telescope, whatever its azimuth angle is.

The telescope and dome are controlled by a program that interfaces with the motors that turn them.

Procedure

  1. Sketch C++ class declarations for both telescope and dome, choosing appropriate representations for their attributes that are relevant to the problem. Include prototypes for functions to position the telescope and the dome.
  2. Relate the two classes in these three ways: a. by inheritance: the "isa" relationship b. by composition (or containment): the "hasa" relationship c. by using the friend declaration
  3. In each case, show how the dome can be slaved to the telescope. What this means is that whenever the function to move the telescope is called, the corresponding dome function can be called to follow the telescope's motion.
  4. Which, in your estimation, is the best approach in this case, i.e. which is the best model of the actual real-world relationships between dome and telescope?

Due Date

Hand in your completed assignment to RTH on Tuesday, November 7th..