I am trying to create an array of objects but I want them to be created using a constructor which takes parameters. This has been my attempt so far.
class myclass {
int n;
myclass(int n) : n(n) {}
}
int main() {
int m = 5;
int n = 4;
myclass* arr = new myclass(n)[m];
}
How can this be achieved?