LogiQuest
Back to Operator Overloading
7

What will be the output of the program?

#include <iostream>
using namespace std;
struct M {
    int v;
    bool operator==(const M &o) const { return v == o.v; }
};
int main() {
    M a{3}, b{3}, c{4};
    cout << (a == b) << (a == c) << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.