阅读背景:

如何在c++中动态地将大小分配给数组?

来源:互联网 

So right now I have a class, called Set, in C++. In it, I have an integer called mCardinality, and an integer array called mElements. I want to be able to accept an integer in the constructor for mCardinality, then use this to assign a size to my integer array, is there any way to do this, or do I absolutely have to have a size for it right off the bat? (I guess I could just make the size the maximum integer, then only use the cardinality for limiting the loops where I deal with the elements, but a neater solution would be preferable).So right now I have a class, called Set, in C++




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: