Documente Academic
Documente Profesional
Documente Cultură
Class Design
Overloading
Inheritance
22. Do not use inheritance when structure and behaviour are same for related classes. 72
23. Prefer object composition over inheritance. 74
24. Avoid inheriting from multiple classes. 76
25. Prohibit inheriting from a standalone class if the class is not meant for inheritance. 80
26. Consider making concrete leaf classes non-inheritable. 84
27. Write code referring to generic interfaces of classes. 86
28. Beware of versioning problems in evolving base classes. 90
29. Avoid deep inheritance hierarchies. 94
Runtime Polymorphism
36. Use virtual functions instead of chained if-else or switch statements. 112
37. Follow Liskov’s Substitution Principle (LSP). 115
38. While overriding, preserve the basic properties of methods. 117
Exception Handling
Namespaces
51. Use namespaces for avoiding name-clashes and organizing the software. 158
52. Avoid hiding of names in different scopes. 160
53. Selectively expose the types to the clients. 164
54. Hierarchically partition the namespace. 166
55. Selectively introduce only the specific namespace members you need to the code. 169