mardi 3 mai 2016

Whats the difference in creating an object using the different new expression syntaxes

Below are the three different ways of initialization in c++ , would you please explain whether there is any difference these three ways if we do not have any arguments

These 3 ways work while creating an object, while returning to a function too (ex: return new myClass)

How and where exactly do each of them fit in individually when other ways fail ?

myClass *p = new myClass;

myClass *p = new myClass();

myClass *p = new myClass{}

Aucun commentaire:

Enregistrer un commentaire