LogiQuest
Back to Operator Overloading
9

What will be the output of the program?

#include <iostream>
using namespace std;
struct F {
    int k;
    int operator()(int x) const { return k * x; }
};
int main() {
    F triple{3};
    cout << triple(7) << endl;
    return 0;
}
Easy

Discussion (0)

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

Log in to join the discussion.