LogiQuest
Back to Constructors and Destructors
8

What will be the output of the program?

#include <iostream>
using namespace std;
class A {
public:
    A() { cout << "1"; }
    A(int) { cout << "2"; }
};
int main() {
    A a, b(5);
    cout << endl;
    return 0;
}
Easy

Discussion (0)

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

Log in to join the discussion.