OOP_Chapter1
OOP_Chapter1
Chapter 1
Introduction
• With the advancement of languages such as C, structured
programming become very popular and was the paradigm of
the 1980s. However, as the programs grew larger, even the
structured approach failed to show the desired results in
terms of bug-free, easy-to-maintain and reusable programs.
• Object-oriented programming (OOP) is an approach to
program organization and development, which attempts to
eliminate some of the pitfalls of conventional programming
methods by incorporating the best of structured programming
features with several new concepts.
What is object-oriented programming ?
• Object-oriented programming is a programming model that
organizes software design around ‘objects’ and ‘classes’, which
contain both data and methods.
Object-oriented programming – As the name
suggests uses objects in programming. Object-oriented
programming aims to implement real-world entities like
inheritance, hiding, polymorphism, etc. in programming.
The main aim of OOP is to bind together the data and the
functions that operate on them so that no other part of
the code can access this data except that function.
There are some basic concepts that act as the building
blocks of OOPs i.e.
– Class
– Objects
– Encapsulation
– Abstraction
– Polymorphism
– Inheritance
– Dynamic Binding
– Message Passing
Class : The building block of C++ that leads to
Object-Oriented programming is a Class. It is a user-
defined data type, which holds its own data
members and member functions, which can be
accessed and used by creating an instance of that
class. A class is like a blueprint for an object.
Eg : A Car can be a class defining a model by concept. Car
can have different properties like color, cost, max speed
etc. These are called data members.
}
Basic concepts of OOP
• Inheritance:
– Inheritance is the process by which objects of one
class acquires the properties of another class.
– This is important because it supports the concept
of hierarchical classification.
Example of Inheritance
Modes of Inheritance: There are 3 modes
of inheritance.
Public Mode: If we derive a subclass from
a public base class. Then the public
member of the base class will become
public in the derived class and protected
members of the base class will become
protected in the derived class.
Protected Mode: If we derive a subclass
from a Protected base class. Then both
public members and protected members
of the base class will become protected in
the derived class.
Private Mode: If we derive a subclass
from a Private base class. Then both
public members and protected members
of the base class will become Private in
the derived class.
Basic concepts of OOP
• Polymorphism:
– Polymorphism comes from Greek word “Poly” => “many”
and “morphism” => “form”.
– Polymorphism in C++ means that the same entity behaves
differently in different scenarios.
1. Real-time systems
2. Simulation and modeling
3. Object-oriented databases
4. Hypertext, hypermedia
5. AI and expert systems
6. Neural networks and parallel programming
7. Decision support and office automation systems
8. CIM/CAD system
Thank you !