1
class Base{
public:
    Base() = default;
    Base(int a_, int b_):a(a_),b(b_){}
    int a;    
    int b;
};

Base *object = new Base(1,2); // works
Base *object2 = new Base(1,2)[10]; // error
Base *object3 = new Base[10](1,2); // error

I want to create an array of Base objects that are initialized using {1,2} but the last two lines of the above code doesn't seem to be working.

user22119
  • 717
  • 1
  • 4
  • 18

0 Answers0