Please look the code below, it's a simple subject but I don't know.
class trial{
public:
trial(){
y = -1;
}
trial(int x){
y = x;
}
public:
int y;
};
int main() {
trial *trialPtr = new trial(); // creates a dynamic object with empty constructor
trial *trialPtr1 = new trial(1); // creates a dynamic object with overloaded constructor
trial *trialPtr2 = new trial[2]; // creates two dynamic objects with empty constructor
return 0;
}
My question is, how can I create two dynamic objects with overloaded constructor?