-
What is the output of this program?
#include <iostream>
using namespace std;
template <class T>
class Example
{
public:
void putPri();
static T ipub;
private:
static T ipri;
};
template <class T>
void Example<T>::putPri()
{
cout << ipri++ << endl;
}
template <class T> T Example<T>::ipub = 1.5;
template <class T> T Example<T>::ipri = 2.5;
int main()
{
Example<int> a;
Example<float> b;
a.putPri();
cout << a.ipub << endl;
b.putPri();
}
-
- 1.5
2.5 - 2.5
2
1 - 2
1
2.5 - 2.5
1.5 - None of these
- 1.5
Correct Option: C
In this program, We are passing the value of specified type and printing it by specialization.