在OOD时,怎样决定何时使用Class何时使用Structure

C++的话,常见的规则是,POD用struct,否则用class。
■网友
对不起,structure是什么?不要总把简单的问题搞复杂,直接用class就行了。再说一句用structure你知道什么是gettersetter嘛?
■网友
? CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.
X AVOID defining a struct unless the type has all of the following characteristics:
It logically represents a single value, similar to primitive types (int, double, etc.).
It has an instance size under 16 bytes.
It is immutable.
【在OOD时,怎样决定何时使用Class何时使用Structure】 It will not have to be boxed frequently.
搬运自MSDN
■网友
所有函数声明成静态,所有数据放在struct里面,所有class声明成静态当命名空间用。


    推荐阅读