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)


Expert's answer

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!

LATEST TUTORIALS
APPROVED BY CLIENTS