在C++中如何初始化一個類的成員數組的所有值?C++初始化一個類的成員數組的所有值
#define MAX_MATRIX 20
Class Matrix {
public:
Matrix(); //constructor
protected:
int n[MAX_MATRIX]; // note cannot do = { 0} or w/e here
};
Matrix::Matrix()
{
// how to set all n to -1?
}
問題甚至不C++ 11存在;-) – 2012-01-31 04:13:21