在這些情況下,在結構上使用類是否有優勢? (注意:它只會保持變量,絕不會有功能)只有數據的類和結構?
class Foo {
private:
struct Pos { int x, y, z };
public:
Pos Position;
};
對戰:
struct Foo {
struct Pos { int x, y, 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?
錯字:應該是{int x,y,z; } – 2010-11-26 16:45:24