LogiQuest
Back to Operator Overloading
2

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{5};
    cout << (a < b) << endl;
    return 0;
}
Hard

Discussion (0)

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

Log in to join the discussion.