【发布时间】:2013-12-16 08:37:56
【问题描述】:
我想在我的main() 中找到一个类中对象的数组大小。
main()
Class1 ojbect1;
short int arraySize;
arraySize = sizeof(object1.myArray)/sizeof(object1.myArray[0]);
Class1
{
public:
static string myArray[];
.....
};
static string myArray[10];
但是我得到了这个错误:
错误:“sizeof”对不完整类型“std::string []”的无效应用
【问题讨论】:
标签: c++ arrays class size main