MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / operator+

Method operator+

week11/examples/shared_ptr.cpp:29–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 std::cout << "Destructor MyTime(). Bye!" << std::endl;
28 }
29 MyTime operator+(int m) const
30 {
31 MyTime sum;
32 sum.minutes = this->minutes + m;
33 sum.hours = this->hours;
34 sum.hours += sum.minutes / 60;
35 sum.minutes %= 60;
36 return sum;
37 }
38 friend std::ostream & operator<<(std::ostream & os, const MyTime & t)
39 {
40 std::string str = std::to_string(t.hours) + " hours and "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected