类模板
#include "stdafx.h"
#include
using namespace std;
template
class A {
public:
A(double r1,double i1) {
r = r1;
i = i1;
}
//simple print();
simple print();
void print(simple c1);
public:
simple c;
double r;
double i;
};
template
simple A::print() {
cout << "r="<<r<<endl;
cout << "i="<<i << endl;
return 0;
};
template
void A::print(simple c1) {
c = c1;
cout <<"c="<< c << endl;
};
int main()
{
Af(5.3, 4);
f.print();
f.print(545.6);
while (1);
return 0;
}