Vidyalelo
C++ Programming · Q845

C++ miscellaneous

Programming · C++ Programming · question 845

Q845

What will be the output of the following C++ code? #include #include #include using namespace std; template class A T a; U b; public: A(T a_val, char b_val = ' ') this->a = a_val; this->b = b_val; void print() cout a1(5,10); A a2(5); A a3(10.0); a1.print(); a2.print(); a3.print(); return 0;

A.
5 10
5 $
10 $
Answer
B.
Nothing
C.
Error
D.
Segmentation fault

Answer: Option A

Solution

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