adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    template<class T = float, int i = 5> class A
    {
        public:
        A();
        int value;
    };
    template<> class A<> 
    { 
        public: A(); 
    };
    template<> class A<double, 10>
    { 
        public: A(); 
    };
    template<class T, int i> A<T, i>::A() : value(i)
    {
        cout << value;
    }
    A<>::A() 
    {
        cout << "default";
    }
    A<double, 10>::A() 
    {
        cout << "10" << endl;
    }
    int main() 
    {
        A<int, 6> x;
        A<> y;
        A<double, 10> z;
    }

a.

6

b.

10

c.

6default10

d.

None of the mentioned

Answer: (c).6default10

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?