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

前端 未结 15 1117
伪装坚强ぢ
伪装坚强ぢ 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:41

    There are a set of macros written Here. THis has convinient property declarations for value types, reference types, read only types, strong and weak types.

    class MyClass {
    
     // Use assign for value types.
     NTPropertyAssign(int, StudentId)
    
     public:
     ...
    
    }
    

提交回复
热议问题