在这样的情况下,使用类超过结构体有什么优势吗?
(注意:它只会保存变量,永远不会有函数)
(注意:它只会保存变量,永远不会有函数)
class Foo { private: struct Pos { int x,y,z }; public: Pos Position; };
与:
struct Foo { struct Pos { int x,z } Pos; };
类似的问题:
> When should you use a class vs a struct in C++?
> What are the differences between struct and class in C++?
> When should I use a struct instead of a class?