CPP00 is the introductory project in the C++ sequence at 42, focusing on fundamental concepts and constructs of C++ programming. This project emphasizes:
- Namespaces: Learning how to use namespaces to avoid name conflicts and organize code.
- Classes and Instances: Understanding how to define classes and create instances, managing visibility with private, protected, and public access specifiers.
- Member Attributes and Functions: Working with attributes and functions that belong to classes, and utilizing initialization lists for proper object setup.
- Accessors and this Keyword: Implementing accessor methods for data encapsulation and using the this pointer to refer to the current object instance.
- stdio Streams: Utilizing standard I/O streams for input and output operations.
- Static and Const: Exploring static members and constant data to manage class-level attributes and immutability.
CPP01 delves into more advanced features of C++ with a focus on memory management and data handling:
- Memory Allocation: Understanding dynamic memory allocation with new and deallocation with delete.
- References and Pointers: Learning about references, pointers, and pointers to members for efficient data manipulation.
- File Streams: Working with file streams to read from and write to files, enhancing file handling capabilities.
CPP02 introduces concepts related to polymorphism and class design, crucial for writing flexible and reusable C++ code:
- Ad-hoc Polymorphism: Implementing polymorphism through function overloading to allow multiple functions with the same name but different parameters.
- Operator Overloading: Defining custom behavior for operators to work with user-defined types.
- Orthodox Canonical Class Form: Adhering to the canonical form of classes to ensure proper handling of copy construction, assignment, and destruction.
CPP03 focuses on inheritance, a core principle of object-oriented programming that allows for the creation of hierarchical class structures:
- Inheritance: Understanding how to derive new classes from existing ones, enabling code reuse and the extension of functionality.
CPP04 culminates in advanced object-oriented concepts and design principles:
- Subtype Polymorphism: Leveraging subtype polymorphism to allow objects of different classes to be treated as objects of a common superclass.
- Virtual Destructors: Implementing virtual destructors to ensure proper cleanup of derived class objects when deleted through base class pointers.
- Abstract Classes: define a common interface with pure virtual functions that must be implemented by derived classes, preventing direct instantiation and enabling polymorphism.