Naming convention for params of ctors and setters

前端 未结 12 1818
轻奢々
轻奢々 2021-01-05 00:42

For those of you who name you member variables with no special notation like m_foo or foo_, how do you name parameters to your ctors and setters?

12条回答
  •  礼貌的吻别
    2021-01-05 01:23

    I name the actual members with trailing underscores, so I do this:

    Foo(int bar) : bar_(bar) { }
    

    The reason is so I can use getter functions without anything like getBar() (bar() is better).

提交回复
热议问题