used to template _step_1

#include <iostream>
using namespace std;

class elem
{
public:
	elem(int n) { i = n; }
	int i;
};


template<class T1>
class ob
{
public:
	ob() {}
	virtual void foo1(T1* tData)
	{
		cout<<"foo1's out"<<endl;
	}
};

template<class T2>
class obEx : public ob<T2>
{
public:
	T2 e;
	
	obEx() {}
	void foo1(T2* tData)
	{
		e = *tData;
	}
};

template<class T4>
void foo2(T4 t)
{
	cout<<t<<endl;
}

void main()
{
	int i = 0;
	ob<int> o;
	obEx<int> ox;
	o.foo1(&i);
	ox.foo1(&i);
	foo2<int>(1);
	system("pause");
}

 

posted on 2012-07-24 22:25  shizuka  阅读(146)  评论(0编辑  收藏  举报

导航