When i define dynamic array of objects, i want to choose one parameterized constructor for all objects in my array. without having to write for each object the chosen constructor like this

```cpp
#include <iostream>

using namespace std;

class foo {
public:
    foo ()
    { 
        cout << "default constructor" << endl;
    }

    foo (int x)
    {
        cout << "parameterized constructor " << endl;
    }

    ~foo ()
    {
        cout << "destructor" << endl;
    }
};

int main (void)
{
    int size = 3, parameter = 10;
    foo *array;
    array = new foo [size] { foo(parameter), foo(parameter), foo(parameter) };

    cout << endl;

    delete [] array;
    return 0;
}

```

output

```
parameterized constructor 
parameterized constructor 
parameterized constructor 

destructor
destructor
destructor

```

So, as you can see from the above code, I can choose parameterized constructor for each object in my array `array = new foo [size] { foo(parameter), foo(parameter), foo(parameter) };`.
However, if user inputs the `size`. same trick won't work

When I searched for solution, I found that I can do it with copy constructor like this

```cpp
#include <iostream>

using namespace std;

class foo {
public:
    foo ()
    { 
        cout << "default constructor" << endl;
    }

    foo (int x)
    {
        cout << "parameterized constructor " << endl;
    }

    ~foo ()
    {
        cout << "destructor" << endl;
    }
};

int main (void)
{
    int size = 3, parameter = 10;
    foo *array;
    array = new foo [size];

    cout << endl;

    for (int i = 0; i < size; i++)
        array[i] = foo(parameter);

    cout << endl;

    delete [] array;
    return 0;
}

```

output

```
default constructor
default constructor
default constructor

parameterized constructor 
destructor
parameterized constructor 
destructor
parameterized constructor 
destructor

destructor
destructor
destructor

```

However, destructors are called for each object, and i don't want this
i just want to do it while allocating for the first time

Thanks in advance, and I hope that there's a solution.