模板类派生模板类

#include
using namespace std;
template 
class A
{
public:
	T a;
public:
	A(T a = 0)
	{
		this->a = a;
	}
	void printfA()
	{
		cout << "a= "<
class B :public A < T >
{
public:
	B(T a = 0, T b = 0) :A(a)
	{
		this->b = b;
	}
	void printfB()
	{
		cout <<"a="<< a<<"  b="< a1;
	a1.printfA();

	B b1;
	b1.printfB();
	system("pause");
	return 0;
}

 

你可能感兴趣的:(C++)