DEV Community

Adhyan Jain
Adhyan Jain

Posted on • Edited on

Week 3 of My C++ Learning Journey: Memory Management, OOP & STL

Overview

This week, I explored memory allocation, object-oriented programming (OOP), and the Standard Template Library (STL)β€”key concepts for writing efficient, modular, and scalable programs. Here's a breakdown of what I covered:


Day 15: Memory Allocation & Static Members

πŸ”Ή Key Topics:

  • Dynamic vs. static memory allocation in classes.
  • Using arrays within a class.
  • Static data members for memory optimization.

πŸ›  Practice Tasks:

βœ… Shop Management System: Implement a class to store item data dynamically.

βœ… Optimized Memory Usage: Modify the system using static members and methods.


Day 16: Arrays of Objects & Object Passing

πŸ”Ή Key Topics:

  • Managing multiple instances using arrays.
  • Passing objects as function arguments.

πŸ›  Practice Tasks:

βœ… Employee Management System: Store multiple employees using an object array.

βœ… Complex Number Operations: Perform arithmetic using object parameters.


Day 17-18: Friend Functions & Friend Classes

πŸ”Ή Key Topics:

  • Accessing private members using friend functions.
  • Sharing data between classes via friend classes.

πŸ›  Practice Tasks:

βœ… Complex Number Addition: Implement a friend function to add two complex numbers.

βœ… Swapping Private Data: Use a friend function to swap values between objects.


Day 19-20: Constructors, Destructors & Inheritance

πŸ”Ή Key Topics:

  • Default, parameterized, overloaded, and copy constructors.
  • Destructor behavior and inheritance hierarchy.

πŸ›  Practice Tasks:

βœ… Bank Deposit Calculator: Use constructors for interest calculation.

βœ… Single Inheritance: Implement an Employee class inherited by Programmer.


Day 21: STL & Advanced Concepts

πŸ”Ή Key Topics:

  • Sorting (Merge Sort), Binary Search.
  • Vectors, Pairs, Tuples, Maps, and Sets.

πŸ›  Practice Tasks:

βœ… Sorting & Searching: Implement Merge Sort and Binary Search.

βœ… STL Containers: Practice with Vectors, Maps, and Sets.


Reflections & Next Steps

This week strengthened my grasp on memory management, OOP principles, and STLβ€”all essential for real-world applications. Next, I’ll focus on advanced STL operations and design patterns.

πŸ’¬ What’s your favorite STL feature? Drop your thoughts below! πŸš€

Top comments (0)