SlideShare a Scribd company logo
Basic Concepts of OOPs Lecture 2 Object Oriented Programming with C++
Basic Concepts of Object-Oriented Programming Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message passing
Basic Concepts of Object-Oriented Programming Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message passing
Starting with C++ classes C with Classes
Classes and Objects A class is a definition of an object.  It's a type just like int.  A class resembles a struct with just one difference :  All struct members are public by default.  All classes members are private by default.
Remember :  A class is a type  object of this class is just a variable
Definition of a class  class name { // members   }
A Simple Class class item { int number; // variables declaration float cost; // private by default Public: void getdata(int a, float b); // functions declaration void putdata(void);   // using prototype }; // ends with semicolon
What is Object Oriented Programming? An object is like a black box. The internal details are hidden. Identifying  objects  and assigning  responsibilities  to these objects. Objects communicate to other objects by sending  messages . Messages are received by the  methods  of an object
What is an object? Tangible Things  as a car, printer, ... Roles  as employee, boss, ... Incidents  as flight, overflow, ... Interactions  as contract, sale, ... Specifications  as colour, shape, …
So, what are objects? an object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain. Or An "object" is anything to which a concept applies. Etc.
Why do we care about objects? Modularity  - large software projects can be split up in smaller pieces. Reuseability  - Programs can be assembled from pre-written software components. Extensibility  - New software components can be written or developed from existing ones.
Example: The Person class #include<string> #include<iostream> class Person{  char name[20];  int yearOfBirth; public:  void displayDetails() {  cout << name << &quot; born in &quot;  << yearOfBirth << endl;  } //... }; private  data public  processes
The two parts of an object Object = Data + Methods or to say the same differently: An object has the responsibility to  know  and the responsibility to  do. = +
Data Functions Object  A Data Functions Object  B Data Functions Object  C Communication Organization of data and functions in OOP Private Public
Class User-defined data type Objects are variables of the type class Any number of objects can be created from one class Collection of objects of similar user-defined data types fruit mango; Will create an object  mango  belonging to the class  fruit .
Data Encapsulation The  wrapping up  of data and functions into a  single unit  ( called class) is known as  encapsulation . Class is not accessible by outside world Only its own functions can access it The insulation of the data from direct access by the program is called  data hiding  or  information hiding .
Data Abstraction Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction They are defined as a list of abstract attribute such as size, weight, cost and functions to operate on these attributes.
Trivia  (something of small importance)   Attributes also called  data members Because the hold information. Functions that operate on these data are called  methods or member functions .
Inheritance Inheritance is the process by which objects of one class acquire the properties of objects of another class. It support the concept of  hierarchical classification . Bird robin  is a part of the class  flying bird  which is again a part of the class  bird .
Bird Attributes Feathers Lay eggs Flying Bird Attributes … . … . Nonflying Bird Attributes … … Robin Attributes … . … . Swallow Attributes … … Penguin Attributes … … Kiwi Attributes … …
Polymorphism Polymorphism is another important OOP concept. Polymorphism, a Greek term, means the ability to take more than one form.
Shape Draw() Circle Object Draw(circle) Box object Draw(box) Triangle object Draw(tringle)
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 know as late binding means the code associated with a given procedure call is not known until the time of the call at run-time.
Message Passing An object oriented program consists of a set of objects that communicate with each other. Employee.salary (name); Object  message  information
Thanks

More Related Content

What's hot (20)

PDF
Overriding
adil raja
 
PDF
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
PPSX
Exception Handling
Reddhi Basu
 
PPTX
JAVA PROGRAMMING
Niyitegekabilly
 
PPTX
constructor with default arguments and dynamic initialization of objects
Kanhaiya Saxena
 
PPTX
Polymorphism presentation in java
Ahsan Raja
 
ODP
Exception Handling In Java
parag
 
DOCX
Data Structure Notes unit 1.docx
kp370932
 
PDF
Python basics_ part1
Elaf A.Saeed
 
PDF
Exception Handling in Java
Java2Blog
 
PPTX
OOP - Understanding association, aggregation, composition and dependency
Mudasir Qazi
 
PDF
Polymorphism In Java
Spotle.ai
 
PPT
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
PDF
Polymorphism in Java
Java2Blog
 
DOCX
JDK,JRE,JVM
Cognizant
 
PDF
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Edureka!
 
PPT
Polymorphism in java
Lovely Professional University
 
PPT
JAVA Polymorphism
Mahi Mca
 
PPT
1. konsep pbo
jona_jona
 
Overriding
adil raja
 
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Exception Handling
Reddhi Basu
 
JAVA PROGRAMMING
Niyitegekabilly
 
constructor with default arguments and dynamic initialization of objects
Kanhaiya Saxena
 
Polymorphism presentation in java
Ahsan Raja
 
Exception Handling In Java
parag
 
Data Structure Notes unit 1.docx
kp370932
 
Python basics_ part1
Elaf A.Saeed
 
Exception Handling in Java
Java2Blog
 
OOP - Understanding association, aggregation, composition and dependency
Mudasir Qazi
 
Polymorphism In Java
Spotle.ai
 
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
Polymorphism in Java
Java2Blog
 
JDK,JRE,JVM
Cognizant
 
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Edureka!
 
Polymorphism in java
Lovely Professional University
 
JAVA Polymorphism
Mahi Mca
 
1. konsep pbo
jona_jona
 

Viewers also liked (11)

PPTX
Object oriented programming concept
Pina Parmar
 
PPTX
Object Oriented Software Engineering
Ali Haider
 
PPTX
Object Oriented Programming Concepts
Bhushan Nagaraj
 
PPT
Object-Oriented Programming Concepts
Kwangshin Oh
 
PPTX
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
PPT
Concepts In Object Oriented Programming Languages
ppd1961
 
PPT
Object oriented programming (oop) cs304 power point slides lecture 01
Adil Kakakhel
 
PPT
Basic concepts of object oriented programming
Sachin Sharma
 
PPTX
Online recruitment system
Komal Singh
 
PPTX
Bus tracking application in Android
yashonil
 
PDF
Object oriented software engineering concepts
Komal Singh
 
Object oriented programming concept
Pina Parmar
 
Object Oriented Software Engineering
Ali Haider
 
Object Oriented Programming Concepts
Bhushan Nagaraj
 
Object-Oriented Programming Concepts
Kwangshin Oh
 
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
Concepts In Object Oriented Programming Languages
ppd1961
 
Object oriented programming (oop) cs304 power point slides lecture 01
Adil Kakakhel
 
Basic concepts of object oriented programming
Sachin Sharma
 
Online recruitment system
Komal Singh
 
Bus tracking application in Android
yashonil
 
Object oriented software engineering concepts
Komal Singh
 
Ad

Similar to Lecture 2 (20)

PPTX
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
PPT
General OOP concept [by-Digvijay]
Digvijay Singh Karakoti
 
PPTX
CPP_,module2_1.pptx
AbhilashTom4
 
PPTX
Basic concept of oops
Padma Kannan
 
DOC
Chapter1
jammiashok123
 
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
PDF
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
PPT
Programming In C++
shammi mehra
 
PDF
Object oriented programming C++
AkshtaSuryawanshi
 
PPTX
Object Oriented Programming fundamentals.pptx
sanaiftikhar23
 
DOC
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 
PPT
Object Oriented Language
dheva B
 
PPTX
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Object Oriented Programming Language is an oop
sanaiftikhar23
 
PPTX
POP vs OOP Introduction
Hashni T
 
PPTX
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
RajendraKumarRajouri1
 
PPTX
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
PPT
introduction-to-object-oriented-programming.ppt
hijat789
 
PPTX
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
General OOP concept [by-Digvijay]
Digvijay Singh Karakoti
 
CPP_,module2_1.pptx
AbhilashTom4
 
Basic concept of oops
Padma Kannan
 
Chapter1
jammiashok123
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Programming In C++
shammi mehra
 
Object oriented programming C++
AkshtaSuryawanshi
 
Object Oriented Programming fundamentals.pptx
sanaiftikhar23
 
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 
Object Oriented Language
dheva B
 
Object Oriented Programming Language is an oop
sanaiftikhar23
 
POP vs OOP Introduction
Hashni T
 
OOSD Lecture 1-1.pptx FOR ENGINEERING STUDENTS
RajendraKumarRajouri1
 
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
introduction-to-object-oriented-programming.ppt
hijat789
 
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
Ad

More from emailharmeet (20)

PPT
Lecture 10 distributed database management system
emailharmeet
 
PPT
Lecture 09 dblc centralized vs decentralized design
emailharmeet
 
PPT
Lecture 09 dblc centralized vs decentralized design
emailharmeet
 
PPT
Lecture 08 distributed dbms
emailharmeet
 
PPT
Lecture 07 relational database management system
emailharmeet
 
PPT
Lecture 06 relational algebra and calculus
emailharmeet
 
PPTX
Testing lecture after lec 4
emailharmeet
 
PPT
Lab 1
emailharmeet
 
PPTX
Revision Lecture
emailharmeet
 
PPT
Lecture 4
emailharmeet
 
PPT
Lecture 3 c++
emailharmeet
 
DOCX
Course File c++
emailharmeet
 
PPT
Lecture 05 dblc
emailharmeet
 
DOCX
Assignmnet 1
emailharmeet
 
PPT
Lecture 04 normalization
emailharmeet
 
PPT
Lecture 03 data abstraction and er model
emailharmeet
 
PPT
Lecture 02 terminology of database
emailharmeet
 
PPT
Lecture 01 introduction to database
emailharmeet
 
PPT
Lecture 00 introduction to course
emailharmeet
 
DOC
Syllabus mca 2 rdbms i
emailharmeet
 
Lecture 10 distributed database management system
emailharmeet
 
Lecture 09 dblc centralized vs decentralized design
emailharmeet
 
Lecture 09 dblc centralized vs decentralized design
emailharmeet
 
Lecture 08 distributed dbms
emailharmeet
 
Lecture 07 relational database management system
emailharmeet
 
Lecture 06 relational algebra and calculus
emailharmeet
 
Testing lecture after lec 4
emailharmeet
 
Revision Lecture
emailharmeet
 
Lecture 4
emailharmeet
 
Lecture 3 c++
emailharmeet
 
Course File c++
emailharmeet
 
Lecture 05 dblc
emailharmeet
 
Assignmnet 1
emailharmeet
 
Lecture 04 normalization
emailharmeet
 
Lecture 03 data abstraction and er model
emailharmeet
 
Lecture 02 terminology of database
emailharmeet
 
Lecture 01 introduction to database
emailharmeet
 
Lecture 00 introduction to course
emailharmeet
 
Syllabus mca 2 rdbms i
emailharmeet
 

Lecture 2

  • 1. Basic Concepts of OOPs Lecture 2 Object Oriented Programming with C++
  • 2. Basic Concepts of Object-Oriented Programming Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message passing
  • 3. Basic Concepts of Object-Oriented Programming Objects Classes Data abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message passing
  • 4. Starting with C++ classes C with Classes
  • 5. Classes and Objects A class is a definition of an object. It's a type just like int. A class resembles a struct with just one difference : All struct members are public by default. All classes members are private by default.
  • 6. Remember : A class is a type object of this class is just a variable
  • 7. Definition of a class class name { // members }
  • 8. A Simple Class class item { int number; // variables declaration float cost; // private by default Public: void getdata(int a, float b); // functions declaration void putdata(void); // using prototype }; // ends with semicolon
  • 9. What is Object Oriented Programming? An object is like a black box. The internal details are hidden. Identifying objects and assigning responsibilities to these objects. Objects communicate to other objects by sending messages . Messages are received by the methods of an object
  • 10. What is an object? Tangible Things as a car, printer, ... Roles as employee, boss, ... Incidents as flight, overflow, ... Interactions as contract, sale, ... Specifications as colour, shape, …
  • 11. So, what are objects? an object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain. Or An &quot;object&quot; is anything to which a concept applies. Etc.
  • 12. Why do we care about objects? Modularity - large software projects can be split up in smaller pieces. Reuseability - Programs can be assembled from pre-written software components. Extensibility - New software components can be written or developed from existing ones.
  • 13. Example: The Person class #include<string> #include<iostream> class Person{ char name[20]; int yearOfBirth; public: void displayDetails() { cout << name << &quot; born in &quot; << yearOfBirth << endl; } //... }; private data public processes
  • 14. The two parts of an object Object = Data + Methods or to say the same differently: An object has the responsibility to know and the responsibility to do. = +
  • 15. Data Functions Object A Data Functions Object B Data Functions Object C Communication Organization of data and functions in OOP Private Public
  • 16. Class User-defined data type Objects are variables of the type class Any number of objects can be created from one class Collection of objects of similar user-defined data types fruit mango; Will create an object mango belonging to the class fruit .
  • 17. Data Encapsulation The wrapping up of data and functions into a single unit ( called class) is known as encapsulation . Class is not accessible by outside world Only its own functions can access it The insulation of the data from direct access by the program is called data hiding or information hiding .
  • 18. Data Abstraction Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction They are defined as a list of abstract attribute such as size, weight, cost and functions to operate on these attributes.
  • 19. Trivia (something of small importance) Attributes also called data members Because the hold information. Functions that operate on these data are called methods or member functions .
  • 20. Inheritance Inheritance is the process by which objects of one class acquire the properties of objects of another class. It support the concept of hierarchical classification . Bird robin is a part of the class flying bird which is again a part of the class bird .
  • 21. Bird Attributes Feathers Lay eggs Flying Bird Attributes … . … . Nonflying Bird Attributes … … Robin Attributes … . … . Swallow Attributes … … Penguin Attributes … … Kiwi Attributes … …
  • 22. Polymorphism Polymorphism is another important OOP concept. Polymorphism, a Greek term, means the ability to take more than one form.
  • 23. Shape Draw() Circle Object Draw(circle) Box object Draw(box) Triangle object Draw(tringle)
  • 24. 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 know as late binding means the code associated with a given procedure call is not known until the time of the call at run-time.
  • 25. Message Passing An object oriented program consists of a set of objects that communicate with each other. Employee.salary (name); Object message information