vendredi 26 octobre 2018

Class with reference data member

I have a class, say C, where one of the member data, say X, depends on user input. The user input may differ on every run, and in my current design, all instances of my classes stores a reference to the same object X.

How can I tweak the design so that it allows default constructor with no arguments?

This way I can use copy assignment/copy constructor, make arrays of C, use temporary rvalue etc.

Aucun commentaire:

Enregistrer un commentaire