0% found this document useful (0 votes)
19 views12 pages

Introduction To Oops

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views12 pages

Introduction To Oops

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction to object oriented

programming
Object –Oriented Programming Paradigm
• To overcome the limitations of procedural programming, object-oriented
programming paradigm has been developed which has revolutionized the
process of software development.

• It includes the best features of structured programming but also some new and
powerful features.

• object-oriented programming, the programmers define not only the data, but
also the operations(functions) that can be performed on it together under a
single unit and thus, creating different kinds of variables known as objects.

• An object is a unit of structural and behavioral modularity that contains a set


of properties (or data) as well as the associated functions.
Important Characteristics of Object-oriented Programming
• Object-oriented programming language is a feature that allows a mode of
modularizing programs by forming separated memory area for data as well as
functions that is used as object for making copies of modules as per
requirement.

• OOP pays more importance to data than to function.


• Programs are divided into classes and their member functions
• New data items and functions can be comfortable added whenever essential.
• Data is private and prevented from accessing external functions.
• Objects can communicate with each other through functions.
Key concepts of Object-oriented programming
• There are several fundamental or key concepts in object-oriented programming.
1 Objects:
• Objects are primary run-time entities in an object-oriented programming.
• Every object consists of a state and behaviour. (its own properties and features)
• The state of an object is one of the possible conditions that an object can exist in and is
represented by its characteristics or attributes or data.
• The behaviour of an object determines how an object acts or behaves and is represented
by the operations that it can perform.
• In Oop, the attributes of an object are represented by the variables and the operations
are represented by the functions.
2 classes: (user-defined data type)
• A class is defined as a user-defined data type.
• A class is grouping of objects having identical properties, common behavior, and shared
relationship.
• Objects are nothing but variables of type class.
• Once a class has been declared, the programmer can create a number of objects associated
with that class.
• The syntax used to create an object is similar to the syntax used to create an integer
variable in C.
3 Method:
• An operation required for an object or entity when coded in a class is called a method.
• The operations that are required for an object are to be defined in a class.
• All objects in a class perform certain common actions or operations.
4 Abstraction:
• Hiding of irrelevant details and representing only the essential features
• Two types:
• Data abstraction: hiding the details about the data
• Control abstraction : hiding the implementation details
• Since, the internal details of the class are hidden from the outside world, thus, data
abstraction ensures security of data by preventing it from accidental changes or
manipulations by other parts of the program.
5 Encapsulation:
• The technique of binding or keeping together the data and the functions in a single unit
• Encapsulation is the way to implement data abstraction.
• The data is not accessible by outside functions, only those functions that are able to access
the data are defined within the class.
• The hidden data of a class cannot be accessed directly by the outside world. However, the
member functions of the class act as a medium to access the hidden data.
• This process of preventing the data from the direct access by the external functions is called
data hiding.
6 Inheritance:
• inheritance is the method by which objects of one class get the properties of objects of
another class.
• The class, which is inherited by the other classes, is known as superclass or base class or
parent class
and the class, which inherits the properties of the base class, is called sub class or derived
class or child class.
• The sub class can further be inherited to form other derived classes.
• Eg:
Red Yellow Blue

Orange Green Violet

Reddish Yellowish Bluish


Brown brown brown
• In the above figure, Red , Yellow and blue are the main colors, Orange color
is created from the combination of red and yellow, green is created from
yellow and blue, and violet is created from red and blue. Orange color has
attributes of both red and yellow, which produces a new effect. Thus, many
combinations are possible
7 Polymorphism:
• Polymorphism allows the same function to act differently in different classes.
• it is an important feature of OOP concept and has the ability to take more than one form.
• Different ways of implementing Polymorphism

Polymorphism

Compile-time Run-time

Virtual
Operator Function functions
Overloading overloading
8 Dynamic Binding:
• Dynamic binding is the process of linking of a function call to the actual code of the
function at run-time.
• That is, in dynamic binding, the actual code to be executed is not known to the compiler
until run-time.

geometrical_shape
area()

square rectangle circle


area() area() area()
{ { {
implementation implementation implementation
} } }

Run time polymorphism


9) Message Passing:
• Message passing is a process of interacting between different
objects in a program.
• In object-oriented paradigm , when the program is executed,
these objects interact or communicate with each other by
sending and receiving messages.
• The messages are exchanged by calling the member functions
of the classes.

Object . Display (argument);

Object
Message Data

Communication
Operator
Message passing

You might also like