This repository contains my journey through C++ programming, exploring fundamental concepts through practical exercises. Each module focuses on specific C++ features and programming paradigms.
- CPP00 - Namespaces, Classes, Member Functions
- CPP01 - Memory Allocation, Pointers, References
- CPP02 - Operator Overloading, Canonical Form
- CPP03 - Inheritance
- CPP04 - Polymorphism, Abstract Classes
- CPP05 - Exceptions, Operator Overloading, File Streams
- CPP06 - Casts, Serialization, Static Members
- CPP07 - Templates, Iterators, Algorithms
- CPP08 - STL, Containers, Algorithms
- CPP09 - Polymorphic Containers, Inheritance
- Building and Running
- Key Learning Outcomes
- Code Quality Standards
- Skills Developed
Key Concepts Learned:
- Basic C++ syntax and iostream usage
- Class design and encapsulation
- Member functions and constructors
- Static members and methods
- Input/output formatting
- ex00 - Megaphone: Introduction to C++ iostream, string manipulation, and basic program structure
- ex01 - Phonebook: First class implementation with private members, constructors, and user interaction
- ex02 - Account: Static members, timestamps, and complex class interactions
Key Concepts Learned:
- Stack vs Heap memory allocation
- Pointers and references in C++
- Dynamic memory management with
newanddelete - Object lifetime and scope
- Reference semantics
- ex00 - BraiiiiiiinnnzzzZ: Stack vs heap allocation, constructors/destructors
- ex01 - Zombie Horde: Dynamic array allocation and object initialization
- ex02 - HI THIS IS BRAIN: Understanding pointers vs references
- ex03 - Unnecessary Violence: References as class members and object relationships
- ex04 - Sed is for Losers: File I/O and string manipulation
- ex05 - Harl 2.0: Function pointers and method dispatch
- ex06 - Harl Filter: Switch statements and program flow control
Key Concepts Learned:
- Operator overloading principles
- Copy constructor and assignment operator
- Orthodox Canonical Class Form (The Big Three)
- Fixed-point arithmetic
- Implicit vs explicit type conversions
- ex00 - My First Class in Orthodox Canonical Form: Basic canonical form implementation
- ex01 - Towards a More Useful Fixed-Point Number Class: Type conversions and constructors
- ex02 - Now We're Talking: Complete operator overloading (arithmetic, comparison, increment/decrement)
Key Concepts Learned:
- Class inheritance and the "is-a" relationship
- Protected vs private vs public inheritance
- Virtual destructors and method overriding
- Base class initialization
- Diamond problem basics
- ex00 - Aaaaand... OPEN!: Basic class design with encapsulation
- ex01 - Serena, my Love!: Single inheritance and method overriding
- ex02 - Repetitive Work: Multiple inheritance and method resolution
Key Concepts Learned:
- Virtual functions and polymorphism
- Abstract classes and pure virtual functions
- Deep copy vs shallow copy
- Virtual destructors and proper cleanup
- Dynamic memory management with inheritance
- ex00 - Polymorphism: Basic virtual functions and polymorphic behavior
- ex01 - I Don't Want to Set the World on Fire: Deep copy implementation with Brain class
- ex02 - Abstract Class: Pure virtual functions and abstract base classes
Key Concepts Learned:
- Exception handling and custom exceptions
- Operator overloading (increment, decrement, stream operators)
- File I/O and stream manipulation
- Inheritance and polymorphism with exceptions
- Form and bureaucrat class interactions
- ex00 - Bureaucrat: Exception handling and operator overloading
- ex01 - Form: Inheritance, exceptions, and validation
- ex02 - Shrubbery Creation: File I/O, polymorphism, and exceptions
- ex03 - Intern: Dynamic object creation and exception safety
Key Concepts Learned:
- C++ type casting (static_cast, dynamic_cast, etc.)
- Serialization and deserialization
- Static members and functions
- RTTI (Run-Time Type Information)
- Pseudo-random number generation
- ex00 - Casts: Type casting and RTTI
- ex01 - Serialization: Object serialization and pointer manipulation
- ex02 - Base Class Identification: Dynamic casting and polymorphism
Key Concepts Learned:
- Function and class templates
- Iterator patterns and STL algorithms
- Template specialization
- Generic programming
- Container manipulation
- ex00 - Template: Function templates and specialization
- ex01 - Iter: Iterator usage and template functions
- ex02 - Array: Template classes and array manipulation
Key Concepts Learned:
- Standard Template Library (STL) containers (vector, list, etc.)
- Algorithms (sort, find, etc.)
- Functors and predicates
- Exception safety with containers
- Custom container implementation
- ex00 - Easy Find: STL algorithms and exception handling
- ex01 - Span: Custom container and range algorithms
- ex02 - MutantStack: Stack extension and iterator support
Key Concepts Learned:
- Polymorphic containers
- Multiple inheritance and interfaces
- Abstract base classes and virtual functions
- Dynamic memory management in containers
- Advanced object-oriented design
- ex00 - RPN: Reverse Polish Notation calculator with stack
- ex01 - Bitcoin Exchange: File parsing and data structures
- ex02 - PmergeMe: Polymorphic containers and sorting algorithms
Each exercise contains its own Makefile. To build and run:
# Navigate to any exercise directory
cd cpp0X/exXX
# Compile
make
# Run the executable
./program_name- Understanding when to use stack vs heap allocation
- Proper resource management with constructors/destructors
- RAII (Resource Acquisition Is Initialization) principles
- Encapsulation through private/protected members
- Inheritance hierarchies and polymorphism
- Virtual and pure virtual functions and abstract classes
- Proper class design following C++ best practices
- Operator overloading for natural syntax
- References vs pointers usage patterns
- Static members for class-wide data
- Orthodox Canonical Class Form for robust classes
- Virtual destructors and polymorphic cleanup
- Const correctness
- Proper header file organization
- Memory leak prevention
- Deep copy implementation for resource management
- Virtual destructor usage in inheritance hierarchies
- Code organization and modularity
All exercises follow:
- C++98 standard compliance
- Orthodox Canonical Class Form where applicable
- Proper memory management (no leaks)
- Consistent coding style with clear naming conventions
- Comprehensive error handling
- Problem-solving through incremental complexity
- Code organization with headers and implementation files
- Debugging memory-related issues
- Design patterns in object-oriented programming
- C++ idioms and best practices
This repository represents the foundation of my C++ journey, building from basic syntax to advanced object-oriented concepts. Each exercise builds upon previous knowledge while introducing new challenges and concepts.