ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
What will be the output of the following C++ code
#include <iostream>
using namespace std;
class A{
public:
int a;
A(){
cout<<"Constructor called";
}
} a;
int main(int argc, char const *argv[])
{
return}
Correct Answer: B — Constructor called
In this program, we have defined a global variable an outside main function for which constructor will be called hence the output is printed.