What will be the output of the following C++ code? [code] #include <iostream> using namespace std; template <class T>

What will be the output of the following C++ code?
Code:
    #include <iostream>
    using namespace std;
    template <class T>
    class XYZ
    {
        public:
        void putPri();
        static T ipub;
        private:
        static T ipri; 
    };
    template <class T>
    void XYZ<T>::putPri()
    {
        cout << ipri++ << endl;
    }
    template <class T> T XYZ<T>::ipub = 1;
    template <class T> T XYZ<T>::ipri = 1.2;
    int main()
    {
        XYZ<int> a;
        XYZ<float> b;
        a.putPri();
        cout << a.ipub << endl;
        b.putPri();
    }
A. 1
B. 1.2
C.
1
1.2
D.
1
1
1.2
 

Tìm kiếm

Back
Top