In C++ Write the function definition to overload the operator test for equality
ID: 3905340 • Letter: I
Question
In C++ Write the function definition to overload the operator test for equality == operator to determine if two objects that have dynamic arrays are equal.Write the overload definition in the form ie bool ClockType::operator ==(const ClockType& otherClock) const In C++ Write the function definition to overload the operator test for equality == operator to determine if two objects that have dynamic arrays are equal.
Write the overload definition in the form ie bool ClockType::operator ==(const ClockType& otherClock) const In C++ Write the function definition to overload the operator test for equality == operator to determine if two objects that have dynamic arrays are equal.
Write the overload definition in the form ie bool ClockType::operator ==(const ClockType& otherClock) const Write the overload definition in the form ie bool ClockType::operator ==(const ClockType& otherClock) const
Explanation / Answer
//this is the definition of overload function
//Considering ClockType has these instance variable:- (1) hr (2) min (3) sec
//So the solution is
bool ClockType::operator ==(const ClockType& otherClock) const
{
return (hr == otherClock.hr && min == otherClock.min && sec == otherClock.sec);
}
//thanks...................................