Vidyalelo
C++ Programming · Q857

C++ miscellaneous

Programming · C++ Programming · question 857

Q857

What will be the output of the following C++ code? #include using namespace std; template class clsTemplate public: T value; clsTemplate(T i) this->value = i; void test() cout public: clsChild(): clsTemplate ( 0 ) clsChild(char c): clsTemplate ( c ) void test2() test(); ; int main() clsTemplate a( 42 ); clsChild b( 'A' ); a.test(); b.test(); return 0;

A.
42
B.
A
C.
42
A
Answer
D.
A
42

Answer: Option C

Solution

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