Why use prefixes on member variables in C++ classes

前端 未结 29 1349
半阙折子戏
半阙折子戏 2020-11-28 17:39

A lot of C++ code uses syntactical conventions for marking up member variables. Common examples include

  • m_memberName for public members (where public
29条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 17:54

    I use m_ for member variables just to take advantage of Intellisense and related IDE-functionality. When I'm coding the implementation of a class I can type m_ and see the combobox with all m_ members grouped together.

    But I could live without m_ 's without problem, of course. It's just my style of work.

提交回复
热议问题