Jun 21, 2018

[C++] data member with same symbol name as user declared constructor

http://eel.is/c++draft/class.mem#20

In addition, if class T has a user-declared constructor, every non-static data member of class T shall have a name different from T.


i.e
struct foo { 
  ~foo(); 
  int foo;  // OK
};

struct bar { 
  bar(); 
  int bar;  // Error
};

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.