OOP USING C++ – UNIT 1 (Detailed Notes)
1. Introduction to Object Oriented Programming
Object Oriented Programming (OOP) is a programming paradigm that organizes software design around objects
rather than functions. Objects represent real-world entities and contain data members and member functions.
2. Principles / Characteristics of OOP
The main principles of OOP are Class, Object, Encapsulation, Abstraction, Inheritance, Polymorphism, Dynamic
Binding, and Message Passing.
Class
A class is a blueprint or template for creating objects. It defines data members and member functions. No memory is
allocated when a class is declared.
Object
An object is an instance of a class. Memory is allocated when an object is created.
Encapsulation
Encapsulation is the process of binding data and functions together into a single unit. It helps in data hiding and
security.
Abstraction
Abstraction shows only essential features and hides internal implementation details. It reduces complexity.
Inheritance
Inheritance allows a derived class to acquire properties of a base class. It improves code reusability.
Polymorphism
Polymorphism means one function name having multiple forms. It can be compile-time or run-time polymorphism.
Dynamic Binding
Dynamic binding means function calls are resolved at runtime. It is achieved using virtual functions.
Message Passing
Objects communicate with each other through function calls, known as message passing.
3. POP vs OOP
Procedure Oriented Programming focuses on functions, whereas Object Oriented Programming focuses on objects
and data security.
4. Structure of C++ Program
A C++ program consists of header files, namespace declaration, main function, and program statements.
5. Tokens in C++
Tokens are the smallest units of a program. They include keywords, identifiers, constants, operators, and special
symbols.
6. Variables and Data Types
Variables store data values. C++ data types are basic, derived, and user-defined.
7. Type Conversion
Type conversion can be implicit (automatic) or explicit (type casting).
8. Operators
Operators perform operations on operands. Examples include arithmetic, relational, logical, and assignment
operators.
9. Expressions
An expression is a combination of variables, constants, and operators that produces a value.
10. Namespace
Namespace is used to avoid name conflicts. The standard namespace in C++ is std.
11. Flow Control Statements
Flow control statements include decision-making statements like if, if-else, switch, and looping statements like for,
while, do-while.
12. Practical Programs
Simple programs using operators, conditional statements, and loops are part of Unit 1 practicals.
13. Advantages of OOP
OOP provides code reusability, data security, easy maintenance, and real-world modeling.