奇怪的继承问题# Programming - 葵花宝典
h*o
1 楼
template class认不出父类的member,如下
#include
using namespace std;
template
class Matrix {
public:
int a;
};
template
class MatrixB: public Matrix{
void print() { cout << a; // a unrecognized
}
};
int main()
{
MatrixB b;
}
#include
using namespace std;
template
class Matrix {
public:
int a;
};
template
class MatrixB: public Matrix
void print() { cout << a; // a unrecognized
}
};
int main()
{
MatrixB
}