Department of Engineering

IT Services

Exercises

1.
Without writing any code, sketch out how you might create classes to represent Points, Triangles, Rectangles and Squares. How might the class hierarchy be extended to deal with Cuboids, Cubes and Prisms?
2.
Write a program to show the order in which constructors and destructors are called in a hierarchy of derived classes.
3.
Create a class containing 2 integers, then create an object of that class. See if the address of the object is the same as the address of one of the fields.