Answer to Question #314098 in C++ for Rishab Roy

Question #314098

Write a C++ program to overload the + and – operators to find the sum and difference of two instances of Time class having members as hour, minute and second. (Use member function for one and friend function for other)


1
Expert's answer
2022-03-18T15:32:41-0400

Here is program:

class MyClass
{
public:
	MyClass operator+(MyClass &b)
	{
		return MyClass(this->value + b.value);
	}
private:
	int value;
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog