(a) Create a class time that has separate int member data for hour, m…
Previous year question for Object Oriented Programming Using C++.
Question
(a) Create a class time that has separate int member data for hour, minutes and seconds. One constructor should initialize this data to 0 and another should initialize it to fixed values. A member function should display it in 11:59:59 format. The next member function should add two objects of type time passes as arguments. A main() function should create 2 initialized time objects and one that is not initialized. Then it should add two initialized values together, leaving the result in third time variable. Finally should display the value of this third variable. (10)
(b) Discuss the various uses of scope resolution operator by giving suitable examples. (10)
- Year: 2022
- Subject: Object Oriented Programming Using C++
Related pages
More PYQs on Constructor and Destructor Functions
- (a) What is a copy constructor ? What are the advantages of a copy constructor ? Give examples. (b) Write a class employee with two functions get data and put…
- (a) Write 'C++' class for the following : To represent two-dimensional point $(x, y)$, class should contain all different constructors and methods to print poi…