OOPS
Object-Oriented Programming with C++
Move from C to C++ and master object-oriented design: classes, constructors, inheritance, polymorphism, templates, exceptions and the STL.
0%complete
- Lessons
- 19
- Runnable examples
- 70
- Quiz questions
- 76
What you will be able to do
- Explain the four pillars of OOP with real code
- Design classes with constructors, destructors and access control
- Use inheritance, virtual functions and abstract classes
- Overload functions and operators
- Write generic code with templates
- Use STL containers and algorithms productively
Syllabus
Unit 1From C to C++
- 1C++ IntroductionWhere C++ came from, what it adds to C, your first program with iostream and namespaces, and how to compile it.
- 2Input/Output, Strings & ReferencesRead and write with cin and cout, use the std::string class, format output with iomanip, and meet references — C++'s safer alias for a variable.
- 3Functions: Overloading, Defaults & InlineWhat C++ adds to functions: pass by reference, const references, function overloading, default arguments and inline functions.
Unit 2Classes & Objects
- 4OOP ConceptsWhy object-oriented programming exists, the difference from procedural code, and the four pillars — encapsulation, abstraction, inheritance and polymorphism.
- 5Classes & ObjectsDefine a class with data members and member functions, create objects, control access with public and private, and define methods outside the class with ::.
- 6Constructors & DestructorsInitialise objects automatically: default, parameterised and copy constructors, initialiser lists, constructor overloading, and destructors with the order they run in.
- 7Encapsulation, this & static MembersGetters and setters with validation, the this pointer, const member functions, and static data and functions shared by every object.
- 8Friend Functions & ClassesGrant selected functions or classes access to private members — when it is useful, how it works, and why to use it sparingly.
Unit 3Inheritance & Polymorphism
- 9InheritanceReuse and extend classes: base and derived classes, public/protected/private inheritance, the five types of inheritance, constructor order, and the diamond problem.
- 10Operator OverloadingMake your own types work with +, ==, <<, [] and more: member vs friend operators, unary and binary operators, and the rules you must follow.
- 11Virtual Functions & Runtime PolymorphismBase-class pointers to derived objects, why virtual changes which function runs, override, virtual destructors, and how the vtable makes it work.
- 12Abstract Classes & InterfacesPure virtual functions, abstract base classes that cannot be instantiated, interfaces, and the final keyword — designing a clean class hierarchy.
Unit 4Beyond the Basics
- 13TemplatesWrite code once for any type: function templates, class templates, multiple type parameters, non-type parameters and specialisation — the foundation of the STL.
- 14Exception HandlingHandle errors cleanly with try, throw and catch: standard exception classes, multiple and catch-all handlers, custom exceptions, and stack unwinding.
- 15Dynamic Memory & Smart Pointersnew and delete, arrays on the heap, shallow vs deep copy, the rule of three, and modern smart pointers — unique_ptr and shared_ptr — that free memory for you.
- 16STL ContainersThe Standard Template Library's ready-made data structures: vector, list, deque, stack, queue, priority_queue, set, map and their unordered versions — with costs.
- 17Iterators, Algorithms & LambdasWalk any container with iterators, then use the STL algorithms — sort, find, count, binary_search, accumulate, transform — with lambda functions for custom behaviour.
- 18File I/O with fstreamRead and write files the C++ way with ifstream, ofstream and fstream: modes, line-by-line reading, parsing records with stringstream, and binary files.
- 19C++ OOP Cheat Sheet & Exam PrepThe whole OOPS course on one page: syntax for classes, constructors, inheritance and polymorphism, the comparisons examiners love, and programs to practise.