求教:为什么同样这个例子我从堆中申请对象连续调用方法就会出错:Array *arr = new Array(10); //cout<<arr->getLen()<<endl; arr->printInfo()->setLen(5);
省略了include...
int main(void)
{
Array *arr = new Array(10);
arr->printInfo()->setLen(5);
cout<<"len="<<arr->getLen()<<endl;
delete arr;
arr=NULL;
system("pause");
return 0;
}
错误信息:error:base operand od '->' has non-pointer type 'Array'