Object Oriented Programming using C++ Notes
Subject Overview
This paper builds object-oriented programming skills in C++ — program fundamentals and control structures, arrays/
Subject at a glance
4
Units
32
Topics
4
Credits
4
Infographics
Unit-wise Syllabus
4 units — open any unit for detailed topic-wise notes, diagrams and important exam questions
- OOP introduction and basic features
- C++ program structure
- compiling and executing programs
- procedural vs object-oriented languages
- I/O and assignment statements
- constants
- variables
- operators
- data types
- control structures (if-else, nested if, while, do-while, for, jump statements)
Focus
Functions and steps
Objects with data and behaviour
Data
Often global, shared
Encapsulated in classes
Reuse
Copy functions
Inheritance and polymorphism
Examples
C
C++, Java
Study guide
This unit covers the OOP approach, C++ program structure, compiling and running, procedural versus OO languages, I/O, constants, variables, operators, data types and control structures. Write and run programs as you read.
- Array declaration
- single and multi-dimensional arrays
- memory representation
- matrices
- strings and string handling functions
- structures and unions
Holds
Many items of one type
Items of different types
Access
By index: a[2]
By member name: s.age
Example
int marks[5];
struct Student {int roll; char name[20];};
Study guide
You study arrays (single and multi-dimensional), memory representation, matrices, strings and string functions, structures and unions. Practise matrix and string programs.
- Class and function definitions
- scope resolution operator
- private/protected/public members
- nesting of member functions
- object creation and access
- parameterized and copy constructors
- multiple constructors
- dynamic initialization
- destructors
Default
No arguments
Box b;
Parameterised
Takes values
Box b(2, 3);
Copy
Copies another object
Box c(b);
Destructor
Releases resources
~Box()
Study guide
You study classes, member functions, scope resolution, access specifiers, nesting, objects, constructors (parameterised, copy, multiple), dynamic initialisation and destructors. Model a real entity as a class.
- Constructors/destructors under inheritance
- single/multiple/multilevel/hierarchical/hybrid inheritance
- function/unary/binary operator overloading
- binding
- friend and virtual functions
- file opening/closing
- file modes and methods
Single
One base, one derived
Multiple
Two or more bases
Multilevel
A → B → C
Hierarchical
One base, many derived
Hybrid
A mix of the above
Study guide
You study constructors under inheritance, the five inheritance types, function and operator overloading, binding, friend and virtual functions and file handling. Understand when virtual functions are needed.
Why Object Oriented Programming using C++ Matters
OOP in C++ builds design discipline that carries over to Java and Python and is a staple of interviews.
How to Prepare for Object Oriented Programming using C++
- Code every OOP concept in a small program.
- Learn the difference between overloading and overriding.
- Draw class diagrams before coding.
Object Oriented Programming using C++: Frequently Asked Questions
What is polymorphism?
Polymorphism allows the same function name or operator to behave differently depending on context, through overloading or virtual functions.
