阅读下面程序,写出输出结果。
#include <iostream>
using namespace std;
template <class Type>
class Test
{
public:
Test(Type a = 0, Type b = 0, Type c = 0):z(c) { x = a; y = b; }
void Print()
{
cout << x << endl;
cout << y << endl;
}
void Print() const
{
cout << z << endl;
}
private:
Type x, y;
const Type z;
};
int main()
{
Test<float> t1;
t1.Print();
Test<int> t2(1, 9, 6);
t2.Print();
const Test<double> t3(0, 6, 1.8);
t3.Print();
return 0;
}
上面程序的输出结果为: