04.06 · Lesson
Namespaces & Access Control
Namespaces
A logical division of code designed to stop naming conflicts and define scope for identifiers.
- Removes ambiguity when different tasks occur with same name.
- Standard namespace ‘std’ contains inbuilt classes and functions.
Access Specifiers
Define how functions and variables can be accessed outside the class:
- Private: Accessible only within the same class.
- Public: Accessible from anywhere.
- Protected: Accessible within class and child classes (generally used in inheritance).
Additional OOP Notes
Key technical details in C++ OOP:
- Delete: Used to release a unit of memory; delete[] for an array.
- Virtual inheritance: Facilitates creating only one copy of each object if it appears more than once in hierarchy.
- Operator overloading: Standard operators can be redefined for class instances.
Item 28 of 28 · updated 2026-10-12