vendredi 27 décembre 2019

C++ Object Creation through Inputs

I would like to create objects of a class with the name of an input

class Rectangle {
public:
 int width;
 int height;
 ...
 //assume a constructor that assigns (width, height)
}

how would i generate an object of a new name using an input. (not me typing Rectangle myRectangle(1,1); )

assume that there is anywhere from 1 to infinite objects created by the user

(i am not looking for help with the human input, or checking if they still want an input, solely how to use an input to create a uniquely named object)

this is my first stack overflow post so please inform me if i did something wrong.

Cheers,

Coal lad

Aucun commentaire:

Enregistrer un commentaire