0

I could not understand why c++11 allows braced initialization,assignment but not initialization with parenthesis for data members inside class. Below is code snippet for more clarity:

class Person {
private:
    string name="Kapil"; //this is allowed
    string organization{"Test"};//even this works
    string place("Rest"); //this is not working what's wrong?
public:

};

So specifically i am looking for what is reasoning for not allowing parenthesis initialization of data members?

Cœur
  • 37,241
  • 25
  • 195
  • 267
PapaDiHatti
  • 1,841
  • 19
  • 26

0 Answers0