fork download
  1. #include<iostream>
  2. using namespace std;
  3. template<class T1,class T2>
  4. class T{
  5. T1 a;
  6. T2 b;
  7. public:
  8. T(T1 x, T2 y)
  9. {
  10. a=x;
  11. b=y;
  12. }
  13. void show()
  14. {
  15. cout<< "a="<<a <<"b=" <<b;
  16. }
  17. };
  18. int main()
  19. {
  20. T<float,int> T1;
  21. test1.show;
  22. test<int,char>T2;
  23. test2.show();
  24. return 0;
  25. }
Success #stdin #stdout 0.02s 25808KB
stdin
Standard input is empty
stdout
#include<iostream>
using namespace std;
template<class T1,class T2>
class T{
	T1 a;
	T2 b;
	public:
		T(T1 x, T2 y)
		{
		 a=x;
		 b=y;
		}
		void show()
		{
			cout<< "a="<<a <<"b=" <<b;
		}
};
int main()
{
	T<float,int> T1;
	test1.show;
	test<int,char>T2;
	test2.show();
	return 0;
}