How should I order the members of a C++ class?

后端 未结 15 1745
Happy的楠姐
Happy的楠姐 2020-12-04 11:50

Is it better to have all the private members, then all the protected ones, then all the public ones? Or the reverse? Or should there be multiple private, protected and pub

15条回答
  •  [愿得一人]
    2020-12-04 12:28

    Depends entirely on your preference. There is no "the right way".

    When doing C++ in my own pet projects I personally keep convention that I put access modifier before each member or method declaration.

提交回复
热议问题