CH5_2
CH5_2
Introduction 2
{ int h,m,s; {
int duration;
public:
duration=h*3600 + m*60 +s;
time(){}
return duration;
time (int h,int m,int s)
}
{ this->h=h;
main()
this->m=m; {
this->s=s; time t1(2, 1, 25);
} int total;
void display() t1.display();
{ cout<<h<<":"<<m<<":"<<s<<endl; } total=t1;
cout<<"Total sec:"<<total;
operator int(); //conversion function
}
};
Conversion from one class to other class 9