LogiQuest
Back to Constructors and Destructors
13

What will be the output of the program?

#include <iostream>
using namespace std;
class M {
    const int id;
public:
    M(int i) : id(i) {}
    int get() const { return id; }
};
int main() {
    M m(77);
    cout << m.get() << endl;
    return 0;
}
Easy

Discussion (0)

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

Log in to join the discussion.