Does C++11 have C#-style properties?

前端 未结 15 1072
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 03:16

In C#, there is a nice syntax sugar for fields with getter and setter. Moreover, I like the auto-implemented properties which allow me to write

public Foo fo         


        
15条回答
  •  春和景丽
    2020-11-28 03:44

    Does you class really need to enforce some invariant or is it just a logical grouping of member elements? If it is the latter you should consider making the thing a struct and accessing the members directly.

提交回复
热议问题