0% found this document useful (0 votes)
21 views21 pages

Chap 1

Chap
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)
21 views21 pages

Chap 1

Chap
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/ 21

OBJECT ORIENTED PROGRAMMING

CONTENTS
 Object Oriented Programming
 Concept Of Object Oriented Programming
 Basic Object-Oriented Programming
 Data Members
 Members Function
 Advantages of OOPs
 Simple String Program
 Simple Integer Program
 Simple Character Program
 Simple Float Program
Concept Of Object Oriented Programming
Coop is a Programming pattern where the programs are structured around objects rather than
functions and logic.
It makes the data partitioned into two memory areas, i.e., data and functions, and helps make
the code flexible and modular.
Object-oriented programming mainly focuses on objects that are required to be manipulated.
In OOPs, it can represent data as objects that have attributes and functions.
Object Oriented Programming
Basic Object-Oriented Programming
 Object-An O Object can be defined as an entity that has a state and behavior is called an
object.
It can represent a dog, a person, a table, etc.
An object means the combination of data and programs, which further represent an entity.

 Classes-Class can be defined as a plan of the object.


It is basically a collection of objects which act as building blocks.
Basic Object-Oriented Programming (cont)
Abstraction- Abstraction helps in the data hiding process. It helps in displaying the essential
features without showing the details or the functionality to the user. It avoids unnecessary
information details and shows only that specific part which the user wants to see.
Basic Object-Oriented Programming
 Encapsulation- The wrapping up of data and functions together in a single unit is
known as encapsulation. It can be achieved by making the data members' scope
private and the member function’s scope public to access these data members.
Encapsulation makes the data non-accessible to the outside world.
Basic Object-Oriented Programming
Inheritance- Inheritance is the process in which two classes have an is-a relationship among each
other and objects of one class acquire properties and features of the other class. The class which
inherits the features is known as the child class, and the class whose features it inherited is called
the parent class. For example, Class Vehicle is the parent class, and Class Bus, Car, and Bike are
child classes.
Basic Object-Oriented Programming
Polymorphism- It means many forms.
It is the ability to take more than one form. Polymorphism allows us to perform a
single action in different ways.
DYNAMIC BINDING
Binding refers to the linking of a procedure call to the code to the executed in
response to the call.

Dynamic binding means the code associated with a given procedure call is not
known until the time of the call at run-time.

It is associated with a polymorphic reference depends upon the dynamic type of


that reference
DYNAMIC BINDING(cont)
MESSAGE PASSING

An object oriented program consists of a set of objects that communicate with


each other.

A message for an object is a request for execution of a procedure and therefore will
invoke a function (procedure) in the receiving object that generates the desired
result.

Message passing involves specifying the name of the object, the name of the
function (message) and information to be sent.
MESSAGE PASSING
Data Members And Member Functions
• Data members are the data variables.

• Member functions are the functions used to affect these variables and together these data members
and member functions defines the properties and behavior of the objects in a Class.
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.
 Object-oriented programming is easy to implement.
 It is easy to partition the work in a project based on objects.
 Object-oriented systems can be easily upgraded from small to large systems.
 Message passing techniques for communication between objects makes the interface
description with external systems much simpler.
 Software complexity can be easily managed.
Application Of Oop
The most popular application of oops up to now, has been in the area of user interface design
such as windows.

There are hundreds of windowing systems developed using oop techniques.

Real business systems are often much more complex and contain many more objects with
complicated attributes and methods.

OOP is useful in this type of applications because it can simplify a complex problem.

The promising areas for application of oop includes.


1. Real – Time systems.
2. Simulation and modeling
3. Object oriented databases.
4. Hypertext,hypermedia and expertext.
5. Al and expert systems.
6. Neural networks and parallel programming.
7. Decision support and office automation systems.
8. CIM / CAM / CAD system.
Simple String Program
#include<iostream>
using namespace std;
Int main()
{
cout<<“Hello word”<<endl;
return 0;
}
Simple Integer Program
#include<iostream>
using namespace std;

int main()
{
int var1, var2;
Int var1 = 20;
var2 = var1 + 10 ;
cout << "var2 is = ";
cout << var2<<endl;
return 0;

}
Simple Character Program
#include<iostream>
using namespace std;
int main()
{
char charvar1 = 'A';
char chrvar2 = '\t’;
//charvar1 = 'B';
cout << charvar1;
cout << '\n';
return 0;
}
Simple Float Program

#include <iostream>
using namespace std;
int main()
{

cout <<("the output is = " );


cout << (3.5 + 4 + 5) << endl;

return 0;
}

You might also like