SlideShare a Scribd company logo
INTRODUCTION
TO
OBJECT-ORIENTED
PROGRAMMING
INTRODUCTION
•PROGRAMMERS WRITE INSTRUCTIONS IN VARIOUS PROGRAMMING
LANGUAGES TO PERFORM THEIR COMPUTATION TASKS SUCH AS:
(I) MACHINE LEVEL LANGUAGE
(II) ASSEMBLY LEVEL LANGUAGE
(III) HIGH LEVEL LANGUAGE
LEVELS OF PROGRAMMING LANGUAGES
• Machine code or machine language is a set of instructions
executed directly by a computer's central processing unit
(CPU). Every program directly executed by a CPU is made up
of a series of such instructions.
Machine language
• An assembly language is a low-level programming language for a
computer, or other programmable device, in which there is a very
strong correspondence between the language and the
architecture's machine code instructions. Assembly language is
converted into executable machine code by a utility program
known as assembler
Assembly Language
• High-level language is any programming language that
enables development of a program in much simpler
programming context and is generally independent of the
computer's hardware architecture. High-level language has a
higher level of abstraction from the computer
High level
OBJECT ORIENTED PROGRAMMING
CONCEPT OF OBJECT ORIENTED
PROGRAMMING
OOP is an approach or 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.
An introduction to object-oriented programming.pptx
FEATURES OF OBJECT-ORIENTED PROGRAMMING
1. EMPHASIS IS ON DOING RATHER THAN PROCEDURE.
2. PROGRAMS ARE DIVIDED INTO WHAT ARE KNOWN AS OBJECTS.
3. DATA STRUCTURES ARE DESIGNED SUCH THAT THEY CHARACTERIZE THE
OBJECTS.
4. FUNCTIONS THAT OPERATE ON THE DATA OF AN OBJECT ARE TIED
TOGETHER IN THE DATA STRUCTURE.
5. DATA IS HIDDEN AND CAN’T BE ACCESSED BY EXTERNAL FUNCTIONS.
6. OBJECTS MAY COMMUNICATE WITH EACH OTHER THROUGH FUNCTIONS.
7. NEW DATAAND FUNCTIONS CAN BE EASILY ADDED.
8. FOLLOWS BOTTOM-UP APPROACH IN PROGRAM DESIGN.
BASIC CONCEPTS OF OBJECT-ORIENTED PROGRAMMING
•1. OBJECTS
•2. CLASSES
•3. DATAABSTRACTION AND ENCAPSULATION
•4. INHERITANCE
•5. POLYMORPHISM
•6. DYNAMIC BINDING
•7. MESSAGE PASSING
BASIC OBJECT-ORIENTED
PROGRAMMING
•OBJECT • Objects are the basic run-time entities in an object-oriented system.
They may represent a person, a place, a bank account, a table of
data or any item that the program must handle.
• The fundamental idea behind object-oriented approach is to
combine both data and function into a single unit and these units are
called objects.
• The term objects means a combination of data and program that
represent some real word entity. For example: consider an example
named Amit; Amit is 25 years old and his salary is 2500. The Amit
may be represented in a computer program as an object. The data
part of the object would be (name: amit, age: 25, salary: 2500)
BASIC OBJECT-ORIENTED
PROGRAMMING
•CLASS •A group of objects that share common properties for
data part and some program part are collectively
called as class.
•In c ++ a class is a new data type that contains
member variables and member functions that operate
on the variables.
BASIC OBJECT-ORIENTED
PROGRAMMING
•DATAABSTRACTION
•Abstraction refers to the act of representing essential
features without including the back ground details or
explanations. Classes use the concept of abstraction and
are defined as size, width and cost and functions to operate
on the attributes.
• Data abstraction in object-oriented programming (OOP) is
the practice of hiding complex implementation details
while exposing only essential information to the user.
BASIC OBJECT-ORIENTED
PROGRAMMING
•DATA ENCAPSULATION
•The wrapping up of data and
function into a single unit (called
class) is known as encapsulation.
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
objects data and the program.
BASIC OBJECT-ORIENTED
PROGRAMMING
• INHERITENCE
•Inheritance is the process by which
objects of one class acquire the properties
of another class. In the concept of
inheritance provides the idea of
reusablity. This mean that we can add
additional features to an existing class
with out modifying it. This is possible by
desining a new class will have the
combined features of both the classes.
BASIC OBJECT-ORIENTED PROGRAMMING
• Polymorphism means the ability to take more than one form. An
operation may exhibit different instance. The behaviour depends
upon the type of data used in the operation.
• A language feature that allows a function or operator to be given
more than one definition. The types of the arguments with which
the function or operator is called determines which definition will
be used.
• Overloading may be operator overloading or function
overloading.
• It is able to express the operation of addition by a single operater
say ‘+’. when this is possible you use the expression x + y to
denote the sum of x and y, for many different types of x and y;
integers , float and complex no. You can even define the +
operation for two strings to mean the concatenation of the strings.
POLYMORPHISM:
BASIC OBJECT-ORIENTED PROGRAMMING
•. 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:
BENEFITS OF OOP
• Through inheritance we can eliminate redundant code and extend the use of existing
classes.
• We can build programs from the standard working modules that communicate with one
another, rather than having to start writing the code from scratch.
• This principle of data hiding helps the programmer to build secure programs that can’t be
invaded by code in other parts of the program.
• It is possible to have multiple instances of an object to co-exist with out any interference.
• 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.
APPLICATIONS OF OOP
• 1. Real – time systems.
• 2. Simulation and modeling
• 3. Object oriented databases.
• 4. Hypertext, Hypermedia and expert text.
• 5. Al and expert systems.
• 6. Neural networks and parallel programming.
• 7. Decision support and office automation systems.
• 8. CIM / CAM / CAD system.
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 DATAAND INFORMATION SAFE
FROM LEAKING OR GETTING EXPOSED.
OBJECT-ORIENTED PROGRAMMING IS EASY TO IMPLEMENT.
BASICS OF C++
•C ++ is an object-oriented programming language, C ++ was developed by jarney stroustrup at AT & T bell lab,
USA in early eighties. C ++ was developed from c and simula 67 language.
•C++ COMMENTS
•C++ introduces a new comment symbol //(double slash). Comments start with a double slash symbol and terminate
at the end of line.
// This is an example of
// c++ program
// thank you
BASICS OF C++
• OUTPUT OPERATOR: The statement cout <<”hello, world” displayed the string with in quotes on the screen.
The identifier cout can be used to display individual characters, strings and even numbers. It is a predefined object
that corresponds to the standard output stream. Stream just refers to a flow of data and the standard output stream
normally flows to the screen display. The cout object, whose properties are defined in iostream.h represents that
stream.
• RETURN STATEMENT: In C++ main ( ) returns an integer type value to the operating system. Therefore every
main ( ) in C++ should end with a return (0) statement, otherwise a warning or an error might occur.
• INPUT OPERATOR: The statement cin>> number 1;
Is an input statement and causes. The program to wait for the user to type in a number. The number keyed in is placed
in the variable number1. The identifier cin is a predefined object in C++ that corresponds to the standard input stream.
Here this stream represents the key board.
STRUCTURE OF A PROGRAM IN C++
•// My first program in C++
•#include <iostream>
•Using namespace std;
•Int main ()
•{
•Cout << "hello world!";
•Return 0;
•}
OUTPUT:-HELLO WORLD!
STRUCTURE OF C++ PROGRAM WITH OOP
• EXAMPLE :-
# Include<iostream.h>
Class Human {
Public:
std::string name;
std::string occupation;
int age;
void eat(){
std::cout << “This person is eatingn;
}
void drink(){
std::cout << “This person is drinkingn;
};
int main(){
Human human1;
human1. name = “Rick”
human1.occupation = “scientist”;
human1.age = 70;
std::cout <<human1.name << ‘n’;
std::cout <<human1.occupation << ‘n’;
std::cout <<human1.age << ‘n’;
human1.eat()
human1.drink()
return 0;
;
STRUCTURE OF C++ PROGRAM WITH OOP
• EXAMPLE :-
# Include <iostream>
Class Car {
Public:
std::string Make;
std::string model
int age;
void accelerate(){
std::cout << “You step on the Gas!n;
}
void brake(){
std::cout << “You step on the brakes!n;
};
int main(){
Car car1;
car1.make = “Ford”;
car1.model= “Mustang”;
car1.year = 2024;
std::cout <<car1.make<< ‘n’;
std::cout <<car1.model<< ‘n’;
std::cout <<car1.year<< ‘n’;
car1.accelerate()
car1.brake()
An introduction to object-oriented programming.pptx

More Related Content

Similar to An introduction to object-oriented programming.pptx (20)

PDF
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
PPTX
POP vs OOP Introduction
Hashni T
 
PPT
the education purpose of software C++.ppt
FarookMohamed12
 
PPT
C++ basic intro on c++ programming language ppt
PavithraD65
 
PPTX
CPP-Unit 1.pptx
YashKoli22
 
PPT
Oops and c fundamentals
umesh patil
 
PPTX
object oriented programming language in c++
Ravikant517175
 
PDF
C++
Rome468
 
PPT
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
PPTX
Ch 1 Introduction to Object Oriented Programming.pptx
MahiDivya
 
PDF
Object oriented concepts
Pranali Chaudhari
 
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
PPTX
C++ in object oriented programming
Saket Khopkar
 
DOCX
LECTURE NOTES ON Object Oriented Programming Using C++
SandeepAwasthi15
 
PPT
Bca 2nd sem u-1 iintroduction
Rai University
 
PPTX
Object oriented programming
sana younas
 
PPTX
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
vidhimangal05
 
PPTX
Object Oriented Programming using c++ main four piller in this
vidhimangal05
 
PDF
CS305PC_C++_UNIT 1 notes jntuh third semester
VeeraswamyDasari2
 
PDF
Object Oriented Programming With C 2140705 Darshan All Unit Darshan Institute...
hslinaaltosh
 
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
POP vs OOP Introduction
Hashni T
 
the education purpose of software C++.ppt
FarookMohamed12
 
C++ basic intro on c++ programming language ppt
PavithraD65
 
CPP-Unit 1.pptx
YashKoli22
 
Oops and c fundamentals
umesh patil
 
object oriented programming language in c++
Ravikant517175
 
C++
Rome468
 
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
Ch 1 Introduction to Object Oriented Programming.pptx
MahiDivya
 
Object oriented concepts
Pranali Chaudhari
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
C++ in object oriented programming
Saket Khopkar
 
LECTURE NOTES ON Object Oriented Programming Using C++
SandeepAwasthi15
 
Bca 2nd sem u-1 iintroduction
Rai University
 
Object oriented programming
sana younas
 
Object Oriented Programming.pptx its a opps concept in c++ which is helpful
vidhimangal05
 
Object Oriented Programming using c++ main four piller in this
vidhimangal05
 
CS305PC_C++_UNIT 1 notes jntuh third semester
VeeraswamyDasari2
 
Object Oriented Programming With C 2140705 Darshan All Unit Darshan Institute...
hslinaaltosh
 

More from olisahchristopher (20)

PPT
Understanding access control in computer security.ppt
olisahchristopher
 
PPT
Introduction to wireless lans_safari.ppt
olisahchristopher
 
PPT
Lect1-Algorithms-and-Flowchart-ppt (1).ppt
olisahchristopher
 
PPTX
artificialneuralnetwork-200611082546.pptx
olisahchristopher
 
PPT
An introduction to data_representation.ppt
olisahchristopher
 
PPT
A detailed overview of computer virus.ppt
olisahchristopher
 
PPT
Understanding logic design in digital electronics.ppt
olisahchristopher
 
PPT
An introduction to Vsat-Presentation-ppt.ppt
olisahchristopher
 
PPTX
Understanding the fundamentals of the internet.pptx
olisahchristopher
 
PPTX
AN INTRODUCTION TO COMPUTER SECURITY TECHNIQUES.pptx
olisahchristopher
 
PPTX
Number Systems in software engineering.pptx
olisahchristopher
 
PPTX
An introduction to Constructors and destructors in c++ .pptx
olisahchristopher
 
PPTX
The conquest of space for elementary.pptx
olisahchristopher
 
PPTX
Object Oriented Programming using c++.pptx
olisahchristopher
 
PPT
Concept of Boolean Algebra & logic gates
olisahchristopher
 
PPT
An introduction to floating point arithmetic.ppt
olisahchristopher
 
PPTX
UNDERSTANDING ADDRESSING MODES1 IN THE CPU.pptx
olisahchristopher
 
PPTX
Introduction to Addressing modes in computer memory.pptx
olisahchristopher
 
PPTX
An introduction to the central processing unit.pptx
olisahchristopher
 
PPTX
Historical development of computers.pptx
olisahchristopher
 
Understanding access control in computer security.ppt
olisahchristopher
 
Introduction to wireless lans_safari.ppt
olisahchristopher
 
Lect1-Algorithms-and-Flowchart-ppt (1).ppt
olisahchristopher
 
artificialneuralnetwork-200611082546.pptx
olisahchristopher
 
An introduction to data_representation.ppt
olisahchristopher
 
A detailed overview of computer virus.ppt
olisahchristopher
 
Understanding logic design in digital electronics.ppt
olisahchristopher
 
An introduction to Vsat-Presentation-ppt.ppt
olisahchristopher
 
Understanding the fundamentals of the internet.pptx
olisahchristopher
 
AN INTRODUCTION TO COMPUTER SECURITY TECHNIQUES.pptx
olisahchristopher
 
Number Systems in software engineering.pptx
olisahchristopher
 
An introduction to Constructors and destructors in c++ .pptx
olisahchristopher
 
The conquest of space for elementary.pptx
olisahchristopher
 
Object Oriented Programming using c++.pptx
olisahchristopher
 
Concept of Boolean Algebra & logic gates
olisahchristopher
 
An introduction to floating point arithmetic.ppt
olisahchristopher
 
UNDERSTANDING ADDRESSING MODES1 IN THE CPU.pptx
olisahchristopher
 
Introduction to Addressing modes in computer memory.pptx
olisahchristopher
 
An introduction to the central processing unit.pptx
olisahchristopher
 
Historical development of computers.pptx
olisahchristopher
 
Ad

Recently uploaded (20)

PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
Horarios de distribución de agua en julio
pegazohn1978
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Ad

An introduction to object-oriented programming.pptx

  • 2. INTRODUCTION •PROGRAMMERS WRITE INSTRUCTIONS IN VARIOUS PROGRAMMING LANGUAGES TO PERFORM THEIR COMPUTATION TASKS SUCH AS: (I) MACHINE LEVEL LANGUAGE (II) ASSEMBLY LEVEL LANGUAGE (III) HIGH LEVEL LANGUAGE
  • 3. LEVELS OF PROGRAMMING LANGUAGES • Machine code or machine language is a set of instructions executed directly by a computer's central processing unit (CPU). Every program directly executed by a CPU is made up of a series of such instructions. Machine language • An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong correspondence between the language and the architecture's machine code instructions. Assembly language is converted into executable machine code by a utility program known as assembler Assembly Language • High-level language is any programming language that enables development of a program in much simpler programming context and is generally independent of the computer's hardware architecture. High-level language has a higher level of abstraction from the computer High level
  • 5. CONCEPT OF OBJECT ORIENTED PROGRAMMING OOP is an approach or 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.
  • 7. FEATURES OF OBJECT-ORIENTED PROGRAMMING 1. EMPHASIS IS ON DOING RATHER THAN PROCEDURE. 2. PROGRAMS ARE DIVIDED INTO WHAT ARE KNOWN AS OBJECTS. 3. DATA STRUCTURES ARE DESIGNED SUCH THAT THEY CHARACTERIZE THE OBJECTS. 4. FUNCTIONS THAT OPERATE ON THE DATA OF AN OBJECT ARE TIED TOGETHER IN THE DATA STRUCTURE. 5. DATA IS HIDDEN AND CAN’T BE ACCESSED BY EXTERNAL FUNCTIONS. 6. OBJECTS MAY COMMUNICATE WITH EACH OTHER THROUGH FUNCTIONS. 7. NEW DATAAND FUNCTIONS CAN BE EASILY ADDED. 8. FOLLOWS BOTTOM-UP APPROACH IN PROGRAM DESIGN.
  • 8. BASIC CONCEPTS OF OBJECT-ORIENTED PROGRAMMING •1. OBJECTS •2. CLASSES •3. DATAABSTRACTION AND ENCAPSULATION •4. INHERITANCE •5. POLYMORPHISM •6. DYNAMIC BINDING •7. MESSAGE PASSING
  • 9. BASIC OBJECT-ORIENTED PROGRAMMING •OBJECT • Objects are the basic run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program must handle. • The fundamental idea behind object-oriented approach is to combine both data and function into a single unit and these units are called objects. • The term objects means a combination of data and program that represent some real word entity. For example: consider an example named Amit; Amit is 25 years old and his salary is 2500. The Amit may be represented in a computer program as an object. The data part of the object would be (name: amit, age: 25, salary: 2500)
  • 10. BASIC OBJECT-ORIENTED PROGRAMMING •CLASS •A group of objects that share common properties for data part and some program part are collectively called as class. •In c ++ a class is a new data type that contains member variables and member functions that operate on the variables.
  • 11. BASIC OBJECT-ORIENTED PROGRAMMING •DATAABSTRACTION •Abstraction refers to the act of representing essential features without including the back ground details or explanations. Classes use the concept of abstraction and are defined as size, width and cost and functions to operate on the attributes. • Data abstraction in object-oriented programming (OOP) is the practice of hiding complex implementation details while exposing only essential information to the user.
  • 12. BASIC OBJECT-ORIENTED PROGRAMMING •DATA ENCAPSULATION •The wrapping up of data and function into a single unit (called class) is known as encapsulation. 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 objects data and the program.
  • 13. BASIC OBJECT-ORIENTED PROGRAMMING • INHERITENCE •Inheritance is the process by which objects of one class acquire the properties of another class. In the concept of inheritance provides the idea of reusablity. This mean that we can add additional features to an existing class with out modifying it. This is possible by desining a new class will have the combined features of both the classes.
  • 14. BASIC OBJECT-ORIENTED PROGRAMMING • Polymorphism means the ability to take more than one form. An operation may exhibit different instance. The behaviour depends upon the type of data used in the operation. • A language feature that allows a function or operator to be given more than one definition. The types of the arguments with which the function or operator is called determines which definition will be used. • Overloading may be operator overloading or function overloading. • It is able to express the operation of addition by a single operater say ‘+’. when this is possible you use the expression x + y to denote the sum of x and y, for many different types of x and y; integers , float and complex no. You can even define the + operation for two strings to mean the concatenation of the strings. POLYMORPHISM:
  • 15. BASIC OBJECT-ORIENTED PROGRAMMING •. 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:
  • 16. BENEFITS OF OOP • Through inheritance we can eliminate redundant code and extend the use of existing classes. • We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. • This principle of data hiding helps the programmer to build secure programs that can’t be invaded by code in other parts of the program. • It is possible to have multiple instances of an object to co-exist with out any interference. • 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. APPLICATIONS OF OOP • 1. Real – time systems. • 2. Simulation and modeling • 3. Object oriented databases. • 4. Hypertext, Hypermedia and expert text. • 5. Al and expert systems. • 6. Neural networks and parallel programming. • 7. Decision support and office automation systems. • 8. CIM / CAM / CAD system.
  • 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 DATAAND INFORMATION SAFE FROM LEAKING OR GETTING EXPOSED. OBJECT-ORIENTED PROGRAMMING IS EASY TO IMPLEMENT.
  • 18. BASICS OF C++ •C ++ is an object-oriented programming language, C ++ was developed by jarney stroustrup at AT & T bell lab, USA in early eighties. C ++ was developed from c and simula 67 language. •C++ COMMENTS •C++ introduces a new comment symbol //(double slash). Comments start with a double slash symbol and terminate at the end of line. // This is an example of // c++ program // thank you
  • 19. BASICS OF C++ • OUTPUT OPERATOR: The statement cout <<”hello, world” displayed the string with in quotes on the screen. The identifier cout can be used to display individual characters, strings and even numbers. It is a predefined object that corresponds to the standard output stream. Stream just refers to a flow of data and the standard output stream normally flows to the screen display. The cout object, whose properties are defined in iostream.h represents that stream. • RETURN STATEMENT: In C++ main ( ) returns an integer type value to the operating system. Therefore every main ( ) in C++ should end with a return (0) statement, otherwise a warning or an error might occur. • INPUT OPERATOR: The statement cin>> number 1; Is an input statement and causes. The program to wait for the user to type in a number. The number keyed in is placed in the variable number1. The identifier cin is a predefined object in C++ that corresponds to the standard input stream. Here this stream represents the key board.
  • 20. STRUCTURE OF A PROGRAM IN C++ •// My first program in C++ •#include <iostream> •Using namespace std; •Int main () •{ •Cout << "hello world!"; •Return 0; •} OUTPUT:-HELLO WORLD!
  • 21. STRUCTURE OF C++ PROGRAM WITH OOP • EXAMPLE :- # Include<iostream.h> Class Human { Public: std::string name; std::string occupation; int age; void eat(){ std::cout << “This person is eatingn; } void drink(){ std::cout << “This person is drinkingn; }; int main(){ Human human1; human1. name = “Rick” human1.occupation = “scientist”; human1.age = 70; std::cout <<human1.name << ‘n’; std::cout <<human1.occupation << ‘n’; std::cout <<human1.age << ‘n’; human1.eat() human1.drink() return 0; ;
  • 22. STRUCTURE OF C++ PROGRAM WITH OOP • EXAMPLE :- # Include <iostream> Class Car { Public: std::string Make; std::string model int age; void accelerate(){ std::cout << “You step on the Gas!n; } void brake(){ std::cout << “You step on the brakes!n; }; int main(){ Car car1; car1.make = “Ford”; car1.model= “Mustang”; car1.year = 2024; std::cout <<car1.make<< ‘n’; std::cout <<car1.model<< ‘n’; std::cout <<car1.year<< ‘n’; car1.accelerate() car1.brake()