Examveda

What will be the output of the following C++ code?
#include <iostream>  
using namespace std;
class A{
public:
	int a;
	A(int a=0){
		this->a = a;
	}
};
int main(int argc, char const *argv[])
{
	A a1, a2(10);
	cout<<a2.a;
	return 0;
}

A. 010

B. 100

C. 001

D. Error

Answer: Option A


Join The Discussion

Related Questions on Constructors and Destructors in C plus plus