Skip to content

🧠 This repository is dedicated to Object-Oriented Programming (OOP) in C++, featuring all modules from CPP00 to CPP09 at 42 School.

Notifications You must be signed in to change notification settings

samir-ouaammou/OOP-CPP

Repository files navigation

🧠 C++ Modules – 1337 / 42 Network Journey

Welcome to my C++ modules journey, completed as part of the 1337/42 Curriculum. This repository documents my understanding and progress through C++ Modules 00 β†’ 09, focusing on object-oriented programming, templates, STL, and modern C++ techniques.


πŸ“˜ What is Object-Oriented Programming (OOP)?

Object-Oriented Programming (OOP) is a paradigm where software is structured around objects rather than actions. Objects are instances of classes, which are blueprints for organizing both data and behavior.

πŸ”‘ Core OOP Principles:

Concept Description
Class A blueprint that defines attributes and methods for objects.
Object An instance of a class β€” holds real data and behavior.
Encapsulation Bundling of data and the methods that operate on that data.
Inheritance A class can inherit members and methods from another class.
Polymorphism Different objects can be treated through the same interface, behaving differently.
Abstraction Hiding complex details and showing only the essentials.

πŸ“¦ Module Breakdown & Key Concepts


Screenshot from 2025-07-31 10-12-55

πŸ₯‰ Module 00 – Basics of C++

πŸ”Ž Topics Covered:

  • Namespaces: Used to prevent name conflicts in large projects. (e.g., std)
  • Classes & Objects: Core building blocks of OOP. A class is a blueprint; an object is a usable instance.
  • Member Functions: Functions that belong to a class and operate on its data.
  • stdio Streams: cout, cin, and cerr are used for input/output in C++.
  • Initialization Lists: A concise way to initialize members in a constructor.
  • Static: A static member is shared across all instances of a class.
  • Const: Makes variables read-only or ensures a method doesn’t modify the object.

βœ… Skills Acquired:

  • Building basic classes and objects.
  • Applying access specifiers (private, public, protected).
  • Writing constructors, destructors, and initialization lists.
  • Differentiating between static vs instance members.
  • Using const-correctness in class design.

Screenshot from 2025-07-31 10-13-14

πŸ₯‰ Module 01 – Memory & Pointers

πŸ”Ž Topics Covered:

  • Memory Allocation: Using new and delete to manage dynamic memory.
  • Pointers to Members: Special pointer syntax to refer to class members.
  • References: An alias to another variable (safer alternative to pointers).
  • Switch Statement: A control flow construct to handle multiple conditions efficiently.

βœ… Skills Acquired:

  • Allocating and freeing heap memory.
  • Understanding the difference between stack and heap memory.
  • Using pointers and references effectively.
  • Applying switch-case logic to manage complex decision trees.

Screenshot from 2025-07-31 10-13-29

πŸ₯‰ Module 02 – Operator Overloading & Canonical Form

πŸ”Ž Topics Covered:

  • Ad-hoc Polymorphism: Achieved using function/operator overloading.

  • Operator Overloading: Custom behavior for operators like +, <<, ==, etc.

  • Orthodox Canonical Form:

    • Default constructor
    • Copy constructor
    • Copy assignment operator
    • Destructor

βœ… Skills Acquired:

  • Implementing overloaded operators for custom types.
  • Ensuring proper memory handling via Rule of Three.
  • Building copy-safe and assignable classes.
  • Understanding deep vs shallow copies.

Screenshot from 2025-07-31 10-13-49

πŸ₯‰ Module 03 – Inheritance

πŸ”Ž Topics Covered:

  • Inheritance: Deriving a new class from an existing one.
  • Access Specifiers in inheritance (public, protected, private).
  • Constructor chaining: Calling base class constructors in derived classes.

βœ… Skills Acquired:

  • Building class hierarchies.
  • Reusing and extending functionality using inheritance.
  • Understanding object slicing and how to avoid it.
  • Designing more modular and testable code.

Screenshot from 2025-07-31 10-14-01

πŸ₯‰ Module 04 – Abstract Classes & Interfaces

πŸ”Ž Topics Covered:

  • Subtype Polymorphism: Using base class pointers/references to handle derived types.
  • Virtual Functions: Enables runtime polymorphism.
  • Abstract Classes: Classes with at least one pure virtual function (= 0).
  • Interfaces: Pure abstract classes that define a contract.

βœ… Skills Acquired:

  • Implementing dynamic polymorphism.
  • Designing interfaces and abstract hierarchies.
  • Writing polymorphic code that is flexible and extendable.
  • Understanding the role of virtual destructors.

Screenshot from 2025-07-31 10-14-12

πŸ₯‰ Module 05 – Exceptions & Error Handling

πŸ”Ž Topics Covered:

  • try / catch / throw: Basic exception handling constructs.
  • Exception Safety: Writing code that stays safe under failure.
  • RAII: Pattern to manage resources automatically via object lifetime.

βœ… Skills Acquired:

  • Catching and throwing exceptions cleanly.
  • Designing exception-safe constructors and destructors.
  • Managing resources using RAII to avoid leaks.
  • Differentiating between recoverable and non-recoverable errors.

Screenshot from 2025-07-31 10-14-33

πŸ₯‰ Module 06 – Type Casting in C++

πŸ”Ž Topics Covered:

  • static_cast: Compile-time type conversion.
  • dynamic_cast: Runtime type-safe downcasting (needs polymorphism).
  • const_cast: Removing const/volatile qualifiers.
  • reinterpret_cast: Bit-level conversion; very low-level and unsafe.

βœ… Skills Acquired:

  • Choosing the right cast for the right context.
  • Understanding cast limitations and dangers.
  • Writing cleaner and safer conversion code.
  • Debugging with proper use of dynamic_cast.

Screenshot from 2025-07-31 10-14-52

πŸ₯‰ Module 07 – Templates

πŸ”Ž Topics Covered:

  • Function Templates: Generic functions that work with any type.
  • Class Templates: Classes that take types as parameters.
  • Template Instantiation: Compiler-generated code for used types.

βœ… Skills Acquired:

  • Writing and using generic code.
  • Creating reusable containers and algorithms.
  • Understanding the cost of template bloat.
  • Exploring template specialization and SFINAE.

Screenshot from 2025-07-31 10-15-02

πŸ₯‰ Module 08 – Containers, Iterators, and Algorithms

πŸ”Ž Topics Covered:

  • Templated Containers: map, stack, vector, deque, list, etc.
  • Iterators: Objects for traversing containers.
  • STL Algorithms: sort, find, lower_bound count, for_each, etc.

βœ… Skills Acquired:

  • Navigating and manipulating STL containers.
  • Writing efficient loops with iterators.
  • Using algorithms to write expressive and high-level logic.
  • Integrating lambda functions with STL.

Screenshot from 2025-07-31 10-15-18

πŸ₯‰ Module 09 – STL (Standard Template Library)

πŸ”Ž Topics Covered:

  • Containers: map, stack, vector, deque, list, etc.
  • Iterators: begin(), end(), rbegin(), rend()
  • Algorithms: sort, find, lower_bound count, for_each, etc.
  • Utilities: pair, function, bind, tuple

βœ… Skills Acquired:

  • Mastering STL components.
  • Writing idiomatic, high-level C++.
  • Leveraging generic programming and composability.
  • Building expressive, readable, and maintainable code.

πŸ‘‰ To explore the Merge-Insertion Sort (Ford-Johnson Algorithm) built as part of this module, check out the implementation here: Ford-Johnson Algorithm Repo


🏁 Final Thoughts

Completing these modules gave me a rock-solid foundation in modern C++. From mastering OOP, to leveraging templates and STL, every concept brought me one step closer to becoming a proficient, confident developer. Check the /exXX/ folders for my implementations.


πŸ“¨ Feel free to reach out, contribute, or ask me anything!

πŸ§‘β€πŸ’» Author: Samir Ouaammou
πŸŽ“ 1337 School / 42 Network
πŸš€ Passionate about C++, Linux, and clean code!

About

🧠 This repository is dedicated to Object-Oriented Programming (OOP) in C++, featuring all modules from CPP00 to CPP09 at 42 School.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors