SlideShare a Scribd company logo
OBJECT ORIENTED
PROGRAMMING
C++ : Extension of C
( BCA 209 )
OBJECTIVES OF THE SUBJECT
To understand the basic concepts of Object Oriented
Programming and their applications.
To understand the various programming skills using the
OOP features like Objects, Class, Data Abstraction,
Encapsulation, Inheritance, Polymorphism.
To gain knowledge about the concept of generic
programming using templates.
To understand the concept of file handling and exception
handling.
• C++ began as an expanded version of the
programming language C. The C++ was first
invented by Bjarne Stroustrup in 1979 at Bell
Laboratories in Murray Hill, New Jersey.
• He initially called the language “C with Classes”. However, in
1983 the name was changed to C++.
• The invention of C++ was necessitated by one major
programming factor i.e. increasing complexity. Even though C is
an excellent programming language, it has certain limits. The
essence of C++ is to allow the programmer to comprehend and
manage larger and more complex programs.
INTRODUCTION
DIFFERENCE BETWEEN C AND C++
• C follows the procedural programming paradigm while C+
+ is a multi-paradigm language (procedural as well as
object oriented).
• The basic difference between C and C++ is in terms of
Object Oriented Programming i.e. OOP.
• Basically, C++ extends C with Object Oriented
Features.
Procedural and Object Oriented Programming
• Procedural programming: focus is on the process.
Procedures/functions are written to process data.
Ex:- C
• Object-Oriented programming: focus is on objects,
which contain data and the means
to manipulate the data. Messages
sent to object to perform operations.
Ex:- C++
#include<stdio.h> #include<iostream.h>
void main() void main()
{ {
printf (“hello world n”) ; cout << “hello world n” ;
} }
C PROGRAM C++ PROGRAM
Header Files ( for basic input output )
Write to output screen
Output Operator
It is used to direct a value to
standard output.
FEATURES OF OOP
 OBJECTS
 CLASSES
 ENCAPSULATION
 DATA ABSTRACTION
 INHERITANCE
 POLYMORPHISM
OBJECTS
Objects are the basic run time entities in an object
oriented system. They may represent a person, a place, a
bank account etc. that the program has to handle.
“Object" refers to a particular instance of a class.
Three properties characterize objects:
1. Identity: the property of an object that distinguishes it
from other objects
2. State: describes the data stored in the object
3. Behaviour: describes the methods in the
object's interface by which the object can be used
CLASS
• In object-oriented programming, a class is a construct
that is used to create instances of itself . The entire set of
data and code of object can be made a user defined with
the help of a class.
• In fact, objects are variables of the type class.
• For example, if car has been defined as a class then
car zen;
will create an object zen
belonging to the class car.
example
CLASS
OBJECTS
Attributes
Student S1
Student S2
Member
Functions
Student
Roll_no
Name
Address
Marks
Calc_total_marks()
Calc_avg()
Calc_prcntge()
General Structure of a class
 Class name or name of class
 Data Members
 Member functions
 Access Specifiers
 Declaring objects
Classes in C++
 A class definition begins with the keyword
class.
 The body of the class is contained within a
set of braces, {} ; (notice the semi-colon).
class class_name
{
….
….
….
};
Class body (data member
+ methods)
Any valid
identifier
Inside class
Class item
{
int number;
Float
cost;
Public:
Void
getdata( )
{ cout<<“
Enter no”;
cin>>numbe
r;
cout<<“Ente
r cost”;
Access Specifiers
 Used to specify access rights for the data
members and member functions of the class.
 Depending upon the access level of a class
member, access to it is allowed or denied.
 Within the body, the keywords private: and public:
specify the access level of the members of the
class.
 the default is private.
 Usually, the data members of a class are declared
in the private: section of the class and the
member functions are in public: section.
Classes in C++
class class_name
{
private:
…
…
…
public:
…
…
…
};
Public members or methods
private members or
methods
ENCAPSULATION AND DATAABSTRACTION
• The wrapping up of data and functions into a single unit is
called Encapsulation.
• Example – Class
• The data is not accessible to the outside world and only
those functions that are wrapped inside the class can
access it. This insulation of the data from the direct
access by the program is called data hiding or
information hiding.
• Abstraction refers to the act of representing essential
features without including the background details.
INHERITANCE
• Inheritance is the process by which one class
acquires the properties of objects of another
class.
• Inheritance provides the idea of reusability. This
means we can add additional features to an
existing class without modifying it.
POLYMORPHISM
• Polymorphism, Greek word, means to take more
than one forms.
• An operation may exist different behaviour in
different instances.
• Example – function overloading and operator
overloading
OVERVIEWOFTHESYLLABUS
1st
Unit
• Introduction to the Object-Oriented Approach, Features of
Procedure oriented programming.
• Basic Concepts of Object Oriented Programming
• Benefits of OOP
• Applications of OOP
• Difference between C and C++
• cin, cout operators
• C++ standard libraries
• Introduction to various C++ compilers
2nd
Unit
• Classes and Objects
• Encapsulation, information hiding
• C++ class declaration
• C++ classes: Attributes and methods
• Function Overloading: implementation
• Constructors and destructors
• C++ garbage collection, dynamic memory allocation
• Meta class/abstract classes
3rd
Unit
• Inheritance and Polymorphism: Detail programming
• Types of Inheritance
• Class hierarchy, derivation – public, private & protected
• Aggregation, composition v/s classification hierarchies
• Polymorphism: Categorization of polymorphism
techniques, Method polymorphism, Polymorphism by
parameter
• Operator overloading: Implementation
• Early v/s Late Binding
4th
Unit
• Generic Programming – Introduction, templates
• Template functions, Overloading of template
• Functions
• Files and Exception Handling
• Streams and files
• Namespaces, The basic stream classes: C++ predefined
streams
• Error handling during file operations
• Types of Exception, Catching and Handling Exceptions
Text Book
• E. Balguruswamy, “C++ ”, TMH Publication ISBN 0-07-
462038-x
• A.R.Venugopal, Rajkumar, T. Ravishanker “Mastering
C++”, TMH, 1997
Reference Book
Schildt Herbert, “C++: The Complete Reference”, 4th
Ed., Tata McGraw Hill, 1999
REFERENCE MATERIAL
THANK YOU

More Related Content

Similar to Object oriented programming. (1).pptx (20)

PPTX
C++ & Data Structure - Unit - first.pptx
KONGUNADU COLLEGE OF ENGINEERING AND TECHNOLOGY
 
PPT
Objective-C for iOS Application Development
Dhaval Kaneria
 
PPTX
c++session 1.pptx
PadmaN24
 
PPTX
Interoduction to c++
Amresh Raj
 
PPT
C++Day-1 Introduction.ppt
citizen15
 
PDF
L6
lksoo
 
PPTX
C++ with student management system project
Kratik Khandelwal
 
PPTX
OOP_in_CPP_Animesh_Animated_Diagram.pptx
animesh713331
 
PPTX
OOC MODULE1.pptx
1HK19CS090MOHAMMEDSA
 
PPT
Lecture02
elearning_portal
 
PDF
C++ Version 2
JIGAR MAKHIJA
 
PPTX
ECAP444 - OBJECT ORIENTED PROGRAMMING USING C++.pptx
vmickey4522
 
PPT
Oop(object oriented programming)
geetika goyal
 
PDF
Object Oriented Programming using C++ - Part 1
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
PPTX
Object Oriented Programming using C++ - OOPS concepts using C++ programming l...
PreethaV16
 
PPTX
Presentation 1st
Connex
 
PPT
the education purpose of software C++.ppt
FarookMohamed12
 
DOC
My c++
snathick
 
PPT
C++ basic intro on c++ programming language ppt
PavithraD65
 
C++ & Data Structure - Unit - first.pptx
KONGUNADU COLLEGE OF ENGINEERING AND TECHNOLOGY
 
Objective-C for iOS Application Development
Dhaval Kaneria
 
c++session 1.pptx
PadmaN24
 
Interoduction to c++
Amresh Raj
 
C++Day-1 Introduction.ppt
citizen15
 
L6
lksoo
 
C++ with student management system project
Kratik Khandelwal
 
OOP_in_CPP_Animesh_Animated_Diagram.pptx
animesh713331
 
OOC MODULE1.pptx
1HK19CS090MOHAMMEDSA
 
Lecture02
elearning_portal
 
C++ Version 2
JIGAR MAKHIJA
 
ECAP444 - OBJECT ORIENTED PROGRAMMING USING C++.pptx
vmickey4522
 
Oop(object oriented programming)
geetika goyal
 
Object Oriented Programming using C++ - Part 1
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
Object Oriented Programming using C++ - OOPS concepts using C++ programming l...
PreethaV16
 
Presentation 1st
Connex
 
the education purpose of software C++.ppt
FarookMohamed12
 
My c++
snathick
 
C++ basic intro on c++ programming language ppt
PavithraD65
 

More from baadshahyash (11)

PPTX
Privacy on communication ppt.pptx
baadshahyash
 
PPTX
Size Estimation Harjot.pptx
baadshahyash
 
PPT
HVE UNIT1 CHOICEMAKING. .ppt
baadshahyash
 
PPT
UNIT 3 Dharma & Karma Yoga. .ppt
baadshahyash
 
PPTX
L-30-35huujjjhgjnnjhggbjkiuuhhjkiiijj.pptx
baadshahyash
 
PPT
HVE UNIT2 HARMONY. .ppt
baadshahyash
 
PPT
HVE UNIT3 PROFESSIONAL ETHICS bca syllabus.ppt
baadshahyash
 
PPTX
Title Lorem Ipsubbbbjbjbjbbububuububm.pptx
baadshahyash
 
PPTX
Harjot computer networks veryGBN ARQ.pptx
baadshahyash
 
PPT
HVE UNIT3 ETHOS human values and ethics.ppt
baadshahyash
 
PPTX
Presentation computer of architecture COA.pptx
baadshahyash
 
Privacy on communication ppt.pptx
baadshahyash
 
Size Estimation Harjot.pptx
baadshahyash
 
HVE UNIT1 CHOICEMAKING. .ppt
baadshahyash
 
UNIT 3 Dharma & Karma Yoga. .ppt
baadshahyash
 
L-30-35huujjjhgjnnjhggbjkiuuhhjkiiijj.pptx
baadshahyash
 
HVE UNIT2 HARMONY. .ppt
baadshahyash
 
HVE UNIT3 PROFESSIONAL ETHICS bca syllabus.ppt
baadshahyash
 
Title Lorem Ipsubbbbjbjbjbbububuububm.pptx
baadshahyash
 
Harjot computer networks veryGBN ARQ.pptx
baadshahyash
 
HVE UNIT3 ETHOS human values and ethics.ppt
baadshahyash
 
Presentation computer of architecture COA.pptx
baadshahyash
 
Ad

Recently uploaded (20)

DOCX
presente continuo luis (1).docx riklavoz
olivaresricardo141
 
PPTX
ash green THEMEN PPT WITH CYCLONE DONATIOANS ASN DUNDARTIONPROSAL
Younghusbandwife
 
PDF
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
PPTX
Urban design is a huge concept when it comes to planning.
IshikaPanchal11
 
PPTX
Exploring Types of Rocks Educational Presentation rock forming james harold r...
jamescarllfelomino6
 
PDF
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
PPTX
condylar pptx.in relation to dental seurgery
abishekgowtham586
 
DOCX
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
PDF
Black and Blue Modern Technology Presentation.pdf
hjaders1104
 
PPTX
DEVELOPING-PARAGRAPHS.pptx-developing...
rania680036
 
PDF
AI Intervention in Design & Content Creation
YellowSlice1
 
PDF
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
PPTX
Chapter 2-3.pptxnsnsnsnsnsjsjsjsjejeusuejsjsj
hibaaqabdirisaaq331
 
PPTX
Dndnnnssjsjjsjsjjsssjsjsjjsjsjsjsjjsjsjdn.pptx
Nandy31
 
PDF
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
PPTX
Great_Discoverers_Nohzyxyxyzyzyzyzzyz_Imagptx
kevadiyahem07
 
PPTX
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
PPTX
the very teaching plan extra ordinary.pptx
PamelaOdibeli1
 
PPTX
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
PDF
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
presente continuo luis (1).docx riklavoz
olivaresricardo141
 
ash green THEMEN PPT WITH CYCLONE DONATIOANS ASN DUNDARTIONPROSAL
Younghusbandwife
 
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
Urban design is a huge concept when it comes to planning.
IshikaPanchal11
 
Exploring Types of Rocks Educational Presentation rock forming james harold r...
jamescarllfelomino6
 
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
condylar pptx.in relation to dental seurgery
abishekgowtham586
 
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
Black and Blue Modern Technology Presentation.pdf
hjaders1104
 
DEVELOPING-PARAGRAPHS.pptx-developing...
rania680036
 
AI Intervention in Design & Content Creation
YellowSlice1
 
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
Chapter 2-3.pptxnsnsnsnsnsjsjsjsjejeusuejsjsj
hibaaqabdirisaaq331
 
Dndnnnssjsjjsjsjjsssjsjsjjsjsjsjsjjsjsjdn.pptx
Nandy31
 
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
Great_Discoverers_Nohzyxyxyzyzyzyzzyz_Imagptx
kevadiyahem07
 
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
the very teaching plan extra ordinary.pptx
PamelaOdibeli1
 
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
Ad

Object oriented programming. (1).pptx

  • 1. OBJECT ORIENTED PROGRAMMING C++ : Extension of C ( BCA 209 )
  • 2. OBJECTIVES OF THE SUBJECT To understand the basic concepts of Object Oriented Programming and their applications. To understand the various programming skills using the OOP features like Objects, Class, Data Abstraction, Encapsulation, Inheritance, Polymorphism. To gain knowledge about the concept of generic programming using templates. To understand the concept of file handling and exception handling.
  • 3. • C++ began as an expanded version of the programming language C. The C++ was first invented by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill, New Jersey. • He initially called the language “C with Classes”. However, in 1983 the name was changed to C++. • The invention of C++ was necessitated by one major programming factor i.e. increasing complexity. Even though C is an excellent programming language, it has certain limits. The essence of C++ is to allow the programmer to comprehend and manage larger and more complex programs. INTRODUCTION
  • 4. DIFFERENCE BETWEEN C AND C++ • C follows the procedural programming paradigm while C+ + is a multi-paradigm language (procedural as well as object oriented). • The basic difference between C and C++ is in terms of Object Oriented Programming i.e. OOP. • Basically, C++ extends C with Object Oriented Features.
  • 5. Procedural and Object Oriented Programming • Procedural programming: focus is on the process. Procedures/functions are written to process data. Ex:- C • Object-Oriented programming: focus is on objects, which contain data and the means to manipulate the data. Messages sent to object to perform operations. Ex:- C++
  • 6. #include<stdio.h> #include<iostream.h> void main() void main() { { printf (“hello world n”) ; cout << “hello world n” ; } } C PROGRAM C++ PROGRAM Header Files ( for basic input output ) Write to output screen Output Operator It is used to direct a value to standard output.
  • 7. FEATURES OF OOP  OBJECTS  CLASSES  ENCAPSULATION  DATA ABSTRACTION  INHERITANCE  POLYMORPHISM
  • 8. OBJECTS Objects are the basic run time entities in an object oriented system. They may represent a person, a place, a bank account etc. that the program has to handle. “Object" refers to a particular instance of a class. Three properties characterize objects: 1. Identity: the property of an object that distinguishes it from other objects 2. State: describes the data stored in the object 3. Behaviour: describes the methods in the object's interface by which the object can be used
  • 9. CLASS • In object-oriented programming, a class is a construct that is used to create instances of itself . The entire set of data and code of object can be made a user defined with the help of a class. • In fact, objects are variables of the type class. • For example, if car has been defined as a class then car zen; will create an object zen belonging to the class car.
  • 11. General Structure of a class  Class name or name of class  Data Members  Member functions  Access Specifiers  Declaring objects
  • 12. Classes in C++  A class definition begins with the keyword class.  The body of the class is contained within a set of braces, {} ; (notice the semi-colon). class class_name { …. …. …. }; Class body (data member + methods) Any valid identifier
  • 13. Inside class Class item { int number; Float cost; Public: Void getdata( ) { cout<<“ Enter no”; cin>>numbe r; cout<<“Ente r cost”;
  • 14. Access Specifiers  Used to specify access rights for the data members and member functions of the class.  Depending upon the access level of a class member, access to it is allowed or denied.  Within the body, the keywords private: and public: specify the access level of the members of the class.  the default is private.  Usually, the data members of a class are declared in the private: section of the class and the member functions are in public: section.
  • 15. Classes in C++ class class_name { private: … … … public: … … … }; Public members or methods private members or methods
  • 16. ENCAPSULATION AND DATAABSTRACTION • The wrapping up of data and functions into a single unit is called Encapsulation. • Example – Class • The data is not accessible to the outside world and only those functions that are wrapped inside the class can access it. This insulation of the data from the direct access by the program is called data hiding or information hiding. • Abstraction refers to the act of representing essential features without including the background details.
  • 17. INHERITANCE • Inheritance is the process by which one class acquires the properties of objects of another class. • Inheritance provides the idea of reusability. This means we can add additional features to an existing class without modifying it.
  • 18. POLYMORPHISM • Polymorphism, Greek word, means to take more than one forms. • An operation may exist different behaviour in different instances. • Example – function overloading and operator overloading
  • 19. OVERVIEWOFTHESYLLABUS 1st Unit • Introduction to the Object-Oriented Approach, Features of Procedure oriented programming. • Basic Concepts of Object Oriented Programming • Benefits of OOP • Applications of OOP • Difference between C and C++ • cin, cout operators • C++ standard libraries • Introduction to various C++ compilers
  • 20. 2nd Unit • Classes and Objects • Encapsulation, information hiding • C++ class declaration • C++ classes: Attributes and methods • Function Overloading: implementation • Constructors and destructors • C++ garbage collection, dynamic memory allocation • Meta class/abstract classes
  • 21. 3rd Unit • Inheritance and Polymorphism: Detail programming • Types of Inheritance • Class hierarchy, derivation – public, private & protected • Aggregation, composition v/s classification hierarchies • Polymorphism: Categorization of polymorphism techniques, Method polymorphism, Polymorphism by parameter • Operator overloading: Implementation • Early v/s Late Binding
  • 22. 4th Unit • Generic Programming – Introduction, templates • Template functions, Overloading of template • Functions • Files and Exception Handling • Streams and files • Namespaces, The basic stream classes: C++ predefined streams • Error handling during file operations • Types of Exception, Catching and Handling Exceptions
  • 23. Text Book • E. Balguruswamy, “C++ ”, TMH Publication ISBN 0-07- 462038-x • A.R.Venugopal, Rajkumar, T. Ravishanker “Mastering C++”, TMH, 1997 Reference Book Schildt Herbert, “C++: The Complete Reference”, 4th Ed., Tata McGraw Hill, 1999 REFERENCE MATERIAL