https://imgur.com/a/UCks0vq<p>Full code here:<p><pre><code> #include<iostream>
using namespace std;
class Time
{
public:
int hour;
int min;
Time()
{
hour=min=0;
}
Time(int h,int m)
{
hour=h;
min=m;
}
Time add (Time t)
{
Time t1;
int m=min+t.min;
t1.hour=hour+t.hour+m/60;
t1.min=m%60;
return t1;
}
};
int main()
{
Time t1;
Time t2(8,40);
Time t3(5,30);
t1=t2.add(t3);
cout<<t1.hour<<" "<<t1.min;
return 0;
}
</code></pre>
As shown in the figure above, some of my confusions are clear. But what I fail to understand is how "min" and "hour" gets its value from t2(8,40). I am sorry if this is a too basic question, but I didn't understand so I am asking.
If I am missing any prerequisites to this topic, do tell me about them, that'd help me more for self learning.