> you should always prefer private to protected and protected to public It's well known that protected is not any safer than public. Anybody can inherit and use it. You can still make members private in structs. It's…
Every C++ class declaration ever looks like this: class Foo { public: stuff; private: other stuff; }; What's the point of private-by-default if everybody overrides it anyways?
> structs are raw data structures while classes are fully featured OOP entities. Don't put they in the same box. That's not true. Structs and classes are identical except for the minor functional differences highlighted…
Although it should be possible per standard C++, Microsoft's compilers have trouble dealing with it.
don't forget the ever-menacing leading underscore!
Some relevant discussion here: http://cboard.cprogramming.com/cplusplus-programming/134827-...
Although I can't currently support my claim, I swear that I have gotten compiler warnings for doing so.
There are no rules to limit the kinds of member functions you can add to a struct. Structs can be polymorphic, can have vtables, and don't need to be compatible with C.
> you should always prefer private to protected and protected to public It's well known that protected is not any safer than public. Anybody can inherit and use it. You can still make members private in structs. It's…
Every C++ class declaration ever looks like this: class Foo { public: stuff; private: other stuff; }; What's the point of private-by-default if everybody overrides it anyways?
> structs are raw data structures while classes are fully featured OOP entities. Don't put they in the same box. That's not true. Structs and classes are identical except for the minor functional differences highlighted…
Although it should be possible per standard C++, Microsoft's compilers have trouble dealing with it.
don't forget the ever-menacing leading underscore!
Some relevant discussion here: http://cboard.cprogramming.com/cplusplus-programming/134827-...
Although I can't currently support my claim, I swear that I have gotten compiler warnings for doing so.
There are no rules to limit the kinds of member functions you can add to a struct. Structs can be polymorphic, can have vtables, and don't need to be compatible with C.