Lab 4
Lab 4
UNIVERSITY OF ENGINEERING
AND TECHNOLOGY, LAHORE
Circle.h Header
Circle.cpp – implementation
Department of Computer Science, New Campus
UNIVERSITY OF ENGINEERING
AND TECHNOLOGY, LAHORE
TestCircle.cpp – main
Question: 4
Design and implement a class clockType that manages time. The class clockType should
store hours, minutes, and seconds and display them in the following format (12:30:5). For
any object of clockType, your program should be able to perform the following operations on
that object.
1. Set the time
2. Get the time
3. Display the time
4. Increment the hour by 1
5. Increment the minute by 1
6. Increment the second by 1
7. Create another object of clockType and copy it with the object you created earlier. And see
the values in both objects.
Question: 5
Define a Rectangle class with attributes for length and width. Implement dynamic memory
allocation for storing the dimensions of the rectangle, where both length and width are
dynamically allocated. Add a copy constructor to this class that accepts another Rectangle
object as an argument. Within the copy constructor, perform deep copies of the length and
width attributes to ensure the creation of an independent copy of the original rectangle's
dimensions. Demonstrates the use of cascaded functions