1. Module 5
Overview of Object Oriented Prgg.
Features of OOP - Classes and Objects - “this” pointer - Constructors
and Destructors - Static Data Members, Static Member Functions
and Objects - Inline Functions – Call by reference - Functions with
default Arguments - Functions with Objects as Arguments - Friend
Functions and Friend Classes.
2. Object Oriented Prgg.
SOP OOP
Based on functions Based on classes and objects
Code Reusability is low Code Reusability is high
Does not support Supports inheritance, encapsulation,
polymorphism
C, Pascal, Fortran C++, Java, Python, C#
SOP is better for small programs where
simplicity and performance matter.
OOP is better for large-scale applications
due to modularity and reusability.
3. Object Oriented Prgg.
• Object-Oriented Programming (OOP) is a programming paradigm
based on the concept of objects, which encapsulate data
(attributes) and behavior (methods). It emphasizes modularity,
reusability, and abstraction to improve code organization and
maintainability.
• To support the principles of object-oriented programming, all OOP
languages have three traits in common: encapsulation,
polymorphism, and inheritance.
5. Basic concepts of Object Oriented
Programming
• Class
• It is a way of binding data and functions together.
• The entire set of data and functions can be made a user-defined
data type with the help of a class.
• Once a class has been defined, we can create any number of
objects belonging to that class.
6. Object Oriented Prgg.
• Object
• Object is a basic run time entity.
• Is an Instance of class
• Represents a Place ,Person ,anything that have some attributes.
• Objects take up space in memory.
8. • Data Encapsulation
• The wrapping up of data and functions into a single unit is known
as encapsulation.
• Data encapsulation is the most striking feature of a class.
• The data is not accessible to the outside world, and only those
functions which are wrapped in the class can access it.
• These functions provide the interface between the object's data
and the program.
• This insulation of the data from direct access by the program is
called data hiding or information hiding.
9. Overview of Object Oriented
• Inheritance
• Deriving a new class from the existing one.
• process by which objects of one class acquire the properties of
objects of another class.
• supports the concept of hierarchical classification.
• provides the idea of reusability. This means that we can add
additional features to an existing class without modifying it. This is
possible by deriving a new class from the existing one. The new class
will have the combined features of both the classes.
11. • Data Abstraction
• Abstraction refers to the act of representing essential features
without including the background details or explanations.
12. Overview of Object Oriented
• Polymorphism
• a Greek term, means the ability to take more than one form.
• It is a feature that provides a function or an operator with more
than one definition.
• It can be implemented using function overloading, operator
overloading, function overriding, virtual function.
13. • Dynamic binding
• Binding refers to the linking of a procedure call to the code to be
executed in response to the call.
• Dynamic binding (also known as late binding) means that the code
associated with given procedure call is not known until the time of
the call at run-time. It is associated with polymorphism and
inheritance.
• Message Passing
• a set of objects can communicate with each other by sending and
receiving messages.
14. Object Oriented Prgg. Lang.
C++
• C++ was developed by Bjarne Stroustrup in 1979 at Bell Labs as an
extension of the C programming language.
• It was initially called "C with Classes" and later renamed to C++ in
1983.
• The language was designed to provide object-oriented features while
maintaining the efficiency and flexibility of C.
15. Object Oriented Prgg. Lang.
C++
• C++ was developed by Bjarne Stroustrup in 1979 at Bell Labs as an
extension of the C programming language.
• It was initially called "C with Classes" and later renamed to C++ in
1983.
• The language was designed to provide object-oriented features while
maintaining the efficiency and flexibility of C.
17. Advantages of OOPs
There are various advantages of object-oriented programming.
OOPs provide reusability to the code and extend the use of existing classes.
In OOPs, it is easy to maintain code as there are classes and objects, which
helps in making it easy to maintain rather than restructuring.
It also helps in data hiding, keeping the data and information safe from
leaking or getting exposed.
Object-oriented programming is easy to implement.