Object-Oriented Programming using C++¶
A complete beginner-to-advanced self-study course in modern C++ (C++17)
Instructor: Engr. Dr. Muhammad Nadeem Majeed — Professor, Department of Data Science (PUCIT), University of the Punjab, Lahore
Welcome¶
This is a full university-level course in object-oriented programming with C++, written to be studied on your own. Every concept is paired with a program you can compile and run. Every module ends with practice you can attempt without an instructor. Every lab builds the same project one step further, so you watch a real system grow — and you feel exactly why each OOP feature exists, because you needed it first.
You need one thing to start: a C++ compiler, or an online one. No licence, no special setup.
Read a little, then compile a lot
Programming is learned by writing programs that fail and then fixing them. Everything here is arranged to make that easy — type the code, break it, repair it, and only then move on.
Attempt everything before you read any solution
Reference solutions to the labs and exercises are published, deliberately, so that nobody is stuck. Read one after your own version builds and runs — not before. A solution read first is recognition, not understanding, and you will mistake the one for the other at exactly the wrong moment.
Start here¶
| Step | Page | What you get |
|---|---|---|
| 1 | Prerequisites | What you must already know, plus a refresher of the pointer and reference ideas Module 1 assumes |
| 2 | Set Up Your Toolchain | A working compiler on Windows, Linux/macOS, or online — three routes, no guesswork |
| 3 | Your First Program | Compile, run, and deliberately break a real program from this repository |
| 4 | Reading Compiler Errors | Turn the compiler's output from a wall of noise into a precise diagnosis |
| 5 | Study Plan | Semester, fast-track and revision paces, with a weekly checklist |
New to the course? Take the guided route: Start Here overview.
The 16 modules¶
The sequence runs from thinking in objects, through building and connecting them, to designing and testing a complete application. Each module assumes the ones before it.
| # | Module | Prerequisite |
|---|---|---|
| 1 | C++ and the OOP Mindset — how C++ programs are built; procedural vs object-oriented decomposition; the four pillars | — |
| 2 | Classes and Objects — class vs struct, members, access specifiers, this, headers and sources |
1 |
| 3 | Constructors and Destructors — lifecycle, initialiser lists, explicit, destruction order |
2 |
| 4 | Encapsulation — invariants, information hiding, const-correctness, static members, friend |
3 |
| 5 | Operators and Static Members — overloading rules, << == < [], assignment vs copy construction |
4 |
| 6 | Inheritance — is-a, access modes, construction order, multiple inheritance, the diamond | 5 |
| 7 | Polymorphism — virtual, override/final, dynamic binding, slicing, virtual destructors |
6 |
| 8 | Abstract Classes — pure virtual functions, interfaces, design by contract | 7 |
| 9 | Composition and Association — has-a, ownership, aggregation, forward declarations | 8 |
| 10 | Copying and Resource Management — shallow vs deep copy, Rule of Three/Five/Zero, move semantics | 9 |
| 11 | RAII and Smart Pointers — RAII, unique_ptr/shared_ptr/weak_ptr, ownership |
10 |
| 12 | Templates — function and class templates, deduction, generic programming | 11 |
| 13 | Exception Handling — propagation, custom hierarchies, noexcept, exception safety |
12 |
| 14 | The STL with OOP — containers, iterators, algorithms, lambdas, complexity-based choice | 13 |
| 15 | SOLID and Design Patterns — UML, SOLID, dependency injection, patterns in C++ | 14 |
| 16 | Advanced OOP Capstone — multi-file architecture, persistence, testing, end-to-end refactoring | 1–15 |
All Modules — objectives, concepts and outcomes in full
Practice and assessment¶
- Labs — sixteen labs that build one system: a campus library lending application, from a deliberately clumsy procedural version in Lab 1 to a designed, tested application in Lab 16.
- Exercises — three tiers in every module: warm-up, core, challenge. Attempt before reading solutions.
- Projects — a mid-course project and the assessed capstone, each with a published rubric.
- Quizzes — a self-check quiz after every module.
- Assessments — practice midterms and a practice final, exam-style, with keys kept separate.
Reference¶
- Cheat Sheets — one page per topic, for keeping open beside your editor.
- Glossary — every term the course uses, defined precisely and linked to where it is taught.
- Further Reading — books and official documentation, cited properly, for going deeper.
How to use this course¶
Everything is ordinary Markdown with relative links, so it works the same in two places: right here as a website with search and a sidebar, and browsing the repository on GitHub (or cloned, offline). The website is generated from the same Markdown — there is no separate version to keep track of.
This page is published at https://nadeem-majeedch.github.io/Object-Oriented-Programming-using-CPP/; the repository, with the same pages and every compilable program, is at https://github.com/nadeem-majeedch/Object-Oriented-Programming-using-CPP.
Every program the course uses lives in examples/, organised by module, and always compiles with the same explicit command:
About the instructor and this course
About the instructor — who wrote and teaches this course, his role in it, and how the course is built and why. · Course Information — what it covers, and what an institution must supply for its own delivery.
The one-line credit is above; everything else is on those two pages, kept there rather than repeated through the modules.