While a designing a C++ class, we need to follow some coding standards. Any C++ class follows some naming rules,some declaration order,etc.
- Declare a class with order : public members -> protected members -> private members,while declaration and definition.
- Make data members private and provide access to them through inline public getter/setter functions if needed.
(This breaks the data abstraction paradigm of OOP. So,use getter/setter only when necessarily required like validation,do something else with variable,etc)
- In each section, the declaration should have the following order.
Typedefs and Enums
Methods including static methods
- Friend declaration should always be private.