Home > Back-end >  Just learning conversion constructors inquired of god why can not run the conversion time
Just learning conversion constructors inquired of god why can not run the conversion time

Time:09-16

#include
Using namespace STD.
The class time {
Int h, m, s;
Public:
Time (int hh=0, int mm=0, int ss=0) : h (hh), m (mm), s (ss) {}
Time (int l);
Friend ostream & amp; Operator<(ostream& Out, time t);
Friend cost & amp; Operator> (istream& In time& T);

};

Ostream& Operator<(ostream& Out, time t) {
The out & lt; <"This time is" & lt; Return the out;
}
Istream& Operator> (istream& In time& T) {
Cout & lt; <"Input time" & lt; In & gt;> Todd Harper & gt;> T.m & gt;> T.s.
Return in;
}
Time: the time (int l) {
H=l/3600;
M=l % 3600/60;
S=l % 60;
}
Int main () {
Time t1 (9, 3, 30), t2;
Cout & lt; Operator<(cout, t1);
Cin & gt;> T2;
Cout & lt; Operator<(cout, t2);
Operator> (cin, t2);
Cout & lt; Time t3.
Int s=3600;
T3=(s);
Cout & lt; Return 0;
}

CodePudding user response:

You two constructors, because the one with the default parameters, so the time (int) method cannot confirm call that a,

CodePudding user response:

That should be how to change the

CodePudding user response:

reference 1/f, the truth is right or wrong response:
your two constructors, because a reason with the default parameters, so the time (int) method cannot confirm call that a

Is there a way to achieve is to initialize and can run

CodePudding user response:

The default parameters you are removed

CodePudding user response:

Thank you thank you thank you very much
  • Related