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
  • 34,719
  • 24
  • 185
  • 251
PapaDiHatti
  • 1,729
  • 16
  • 24

0 Answers0