adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    template <class T>
    class A
    {
        public:
        A(int a): x(a) {}
        protected:
        int x;
    };
    template <class T>
    class B: public A<char>
    {
        public:
        B(): A<char>::A(100) 
        {
            cout << x * 2 << endl;
        }
    };
    int main()
    {
        B<char> test;
        return 0;
    }

a.

100

b.

200

c.

error

d.

runtime error

Answer: (b).200

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?