我计划使用数组... myarray(row,col)我想使行= 3和col = 3该数组将在
myclass{
private:
myarray[row][col];
public:
void myfunction(); //will use the value of Row & Col
(Don't worry bout this function, I only put it here
so you know the variables will be accessed)
}
Q。我想我应该将row和col都声明为const变量,,但是我不确定是否应该在类中声明它们。其他类函数将访问它们。我将它们的定义放在我的cpp文件中。非常感谢任何人的建议-预先感谢
您可以使用全局MACRO定义行和列,例如
#DEFINE COL 3
#DEFINE ROW 3
然后在代码中的任何地方使用COL和ROW