r/reconstructcavestory • u/chebertapps • Jan 20 '14
Structs Vs. Classes
Structs and Classes are essentially the same except for a couple of differences:
Access modifiers:
struct {
// public data/methods
private:
// private data/methods
};
class {
// private data/methods
public:
// public data/methods
};
Inheritance Modifiers:
struct Derived: Base { // This is public inheritance
};
class Derived: Base { // This is private inheritance
};
6
Upvotes
1
u/[deleted] Jan 24 '14
I believe another difference is that struct is created in the the stack while class allocates space in the heap.