Objects with arguments and array

前端 未结 4 501
轮回少年
轮回少年 2021-01-06 06:36

Is there a way in C++ where an objects has argument added upon it, with an array such as:

int x = 1;
int y = 2;

Object myObject( x, y )[5]; // does not work         


        
4条回答
  •  囚心锁ツ
    2021-01-06 07:09

    Or something like this:

    int x = 1;
    int y = 2;
    int numObjects = 5;
    
    Object myObjectArray[numObjects];
    
    for (int i=0, i

    Maybe it's a function with x,y and numObjects as params?

提交回复
热议问题