Loading practice questions
What will be the output of the following C++ code
#include
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
Explanation:
In this program, we have defined a global variable an outside main function for which constructor will be called hence the output is printed.