(Program) Write a C++ program that has a Time class and an Ltime class. The Time
ID: 3573201 • Letter: #
Question
(Program) Write a C++ program that has a Time class and an Ltime class.
The Time class should have integer data members named hours, minutes, and seconds, and the Ltime class should have
a long integer data member named elsecs, which represents the number of elapsed seconds since midnight.
For the Time class, include a conversion operator function named Ltime() that converts a Time object to an Ltime object.
For the Ltime class, include a conversion operator function named Time() that converts an Ltime object to a Time object.
Explanation / Answer
#include <iostream>// Header Files
#include<conio.h>
using namespace std;
class Time{
public: //Access - Specifier
int hrs; //Varibale Declaration
int minutes;
int seconds;
Time t=new Time();
void Ltime(){
Ltime lt=t;
}
};
class Ltime{
public: //Access - Specifier
long int hrs; //Varibale Declaration
Ltime t=new Ltime();
void Time(){
Time lt=t;
}
};
//Main Function
int main()
{
getch();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.