0
#include<iostream>
using namespace std;
template<class T>
class array1{
private:
T a;
public:
array1(T b){
a = b;
}
friend ostream& operator<<(ostream& out,array1 b){
out << b.a;
return out;
}
};
int main(){
int* b = new int[2];
b[0] = 5;
b[1] = 10;
array1<int*> num(b);
cout << num;
system("pause");
return 0;
}`
这里我做了一个PRINT函数,所以它会打印类的数据成员。但如果我将使用int它可以很容易地打印,但如果我将使用int *,因为我已经在我的代码中,或者如果我将使用int **在行array1 num(b);模板类的通用打印功能
我想为INT,INT *或者int通用打印功能**