How much functionality is “acceptable” for a C++ struct?

后端 未结 19 2327
礼貌的吻别
礼貌的吻别 2021-02-07 09:31

My first post so please go easy on me!

I know that there\'s no real difference between structs and classes in C++, but a lot of people including me use a struct or class

19条回答
  •  爱一瞬间的悲伤
    2021-02-07 09:54

    I always use structs for 'lumps of data', even if they get decorated with a constructor and sometimes comparison operators, they never get methods added to them (not even get/set methods).

    I think this shows the intent of the type - a struct is just data to be operated on by other things.

提交回复
热议问题