vendredi 4 avril 2014

C++ : Make multiple constructors with the same argument types


Vote count:

0




I would like to make a class with several constructors of the same type. As this is not directly possible, is there a simple way to define readable "dummy" types such as the class could look like:


class Myclass { MyClass(Orange, std::string & name, float size); MyClass(Apple, std::string & name, float size); MyClass(Banana, std::string & name, float size); }


I could define Orange, Apple and Banana as struct typedefs, but is there a more convenient way?


Thanks



asked 53 secs ago






Aucun commentaire:

Enregistrer un commentaire