Vidyalelo
C++ Programming · Q55

Constructors and Destructors in C++

Programming · C++ Programming · question 55

Q55

What will be the output of the following C++ code? #include 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
Answer
B.
100
C.
001
D.
Error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board