OneCompiler

== Overloading

#include <iostream>
using namespace std;
class Time {
public:
Time(int hour = 0, int minute = 0) : hour(hour), minute(minute) {}

bool operator==(const Time& other) const {
    return hour == other.hour && minute == other.minute;
}

private:
int hour;
int minute;
};

int main() {
Time t1(10, 30);
Time t2(10, 30);
Time t3(11, 20);

if (t1 == t2) {
   cout << "t1 and t2 are equal." << std::endl;
} else {
   cout << "t1 and t2 are not equal." << std::endl;
}

}