SlideShare una empresa de Scribd logo
1 de 55
Object-Oriented Programming(OOP) 1 PRANJAL SAINI (LECTURER) B.E.,M.TECH.,MBA
Paradigm Shift in Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ALGORITHMS ,[object Object],[object Object],[object Object],[object Object],[object Object]
Understanding the Algorithm ,[object Object]
The most common block symbols are:
Problem for Flowchart ,[object Object],[object Object],[object Object]
A flowchart representation of the algorithm for the above problem can be as follows:
History of Object-Oriented Programming ,[object Object],[object Object],[object Object]
Object-Oriented Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Object Oriented Languages ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structured Programming Concept(Modular Prog.) ,[object Object],[object Object],[object Object],[object Object]
Cont…. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Procedural Programming  (Procedure oriented)  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Top down approach ,[object Object],[object Object],[object Object],[object Object]
Advantages of the Top-Down    Design Method •  It is easier to comprehend the solution of a smaller and less    complicated problem than to grasp the solution of a large and    complex problem. •  It is easier to test segments of solutions, rather than the    entire solution at once. This method allows one to test the    solution of each sub-problem separately until the entire solution has been tested. •  It is often possible to simplify the logical steps of each sub-   problem, so that when taken as a whole, the entire solution    has less complex logic and hence easier to develop. •  A simplified solution takes less time to develop and will be   more readable. •  The program will be easier to maintain.
Bottom up approach  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Concept of Class and Object ,[object Object],[object Object]
Structure of a Class in C++ class   name  { declarations constructor definition(s) method definitions } attributes and symbolic constants how to create and initialize objects how to manipulate the state of objects These parts of a class can actually be in any order
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Members of class ,[object Object]
Features of OOP  ,[object Object],[object Object],[object Object],[object Object]
Polymorphism  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Polymorphism World India China USA Rajasthan New delhi Washington New york
Inheritance  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Base class Flower Rose Rajasthan Jaipur World India Derived class Single level  Multi level  Multiple Base class Derived class Bird Parrot Sparrow
Class A { }; Class B:public A { }; Class C:public B { }; Class D: public C { };     Multi level Class A { }; Class B { }; Class C:public A, Public B { };   Multiple Class base { Data members and Functions; }; Class derived:public base { Data members and functions; }; Single Level
Hierarchical Inheritance A B C D E F I H G J
I Half(Hierarchical) II Half (Multiple ) Hybrid Hybrid = Hierarchical + Multiple Class D Class A Class B Class  C Hybrid = Multi level+ Multiple Class D Class B Class C Class A Class C Class B Class D Class B Class C Class A
Ex. of Inheritance RTU Engg. college ECE Deptt. EE Deptt. CS Deptt. Civil Deptt. Parent class Child class Sub classes of child class
PPP INHERITANCE  (CLASS MEMBERS) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Encapsulation Encapsulation is the mechanism that binds the data & function in one form known as  class. The data & function may be private or public.
Objects binds together in form of a Class… Animal Dog Cat Fish Mutt Poodle Gold Beta
[object Object],[object Object]
Why Reading Language C++ ? ,[object Object],[object Object],[object Object],[object Object]
Using C++ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C++ Character set ,[object Object],[object Object],[object Object],[object Object],[object Object],ASCII Values
C++ Data types S. No DATA TYPE Size (in bytes) RANGE 1 Short int 2 -32768 to +32767 2 Unsigned short int 2 0 to 65535 3 long int 4 -2147483648 to 2147483647 4 Float 4 3.4e-38 to 3.4e+38 5 Char 1 -128 to 127 6 Unsigned char 1 0 to 255 7 Unsigned long int 4 0 to 4294967295 8 Double 8 1.7e-308 to 1.7e+308 9 Long double 10 1.7e-308 to 1.7e+308
C++ Tokens ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C++ Constants Non Numeric constants  Numeric  Constants Real Constants Integer Constants String Constants Character Constants Decimal, Octal, Hex
C++ Operators  S. No OPERATORS SYMBOLS 1. Arithmetic +,-,/,*,% 2. Logical &&,||,! 3. Relational <,>,>=,<=,==,!= 4. Assignment = 5. Increment ++ 6. Decrement -- 7. Comma , 8. Conditional (Ternary) ?: 9. Bitwise &,|,^,!,>>,<< 10. Special Operator Sizeof 11. Extraction >> 12. Insertion << 13. Dynamic Memory Allocator New 14. Dynamic memory De-allocator Delete
Some streams in <iostream.h> ,[object Object],[object Object],[object Object],[object Object],[object Object]
C  vs  C++  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Program  Hello ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stream Input/Output Keyboard Console Unit INDIA INDIA Stream Input Stream Output
Program  Average ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Call by Reference  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Return by reference ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],i j Temporary storage 8 8 8
Matrix Multiplication ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
cin>>row1; cout<<&quot;enter column for first matrix&quot;; cin>>col1; cout<<&quot;enter elements of first matrix&quot;; for(i=0;i<row1;i++) { for(j=0;j<col1;j++) { cin>>mat1[i][j]; } } cout<<&quot;enter the row of second matrix&quot;; cin>>row2; cout<<&quot;enter column for second matrix&quot;; cin>>col2; cout<<&quot;enter elements of second matrix&quot;;
for(i=0;i<row2;i++) { for(j=0;j<col2;j++) { cin>>mat2[i][j]; } } if(col1==row2) { cout<<&quot;multiplication of matrices is&quot;; for(i=0;i<row1;i++) { for(j=0;j<col1;j++) {
multi[i][j]=0; for(k=0;k<col1;k++) { multi[i][j]+=mat1[i][k]*mat2[k][j]; } cout<<multi[i][j]; }   cout<<endl; } } else cout<<&quot;multiplication is not compatible&quot;; getch(); }
Inline Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Overloading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
“ HAVE A NICE DAY”

Más contenido relacionado

La actualidad más candente

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oopcolleges
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop Kumar
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS abhishek kumar
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classesShreyans Pathak
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)arvind pandey
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarSivakumar R D .
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in javaAhsan Raja
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).pptAlok Kumar
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programmingElizabeth Thomas
 

La actualidad más candente (20)

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
OOP java
OOP javaOOP java
OOP java
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 

Similar a OOP Concepts Explained: Classes, Objects, Inheritance and Polymorphism

Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)geetika goyal
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++KAUSHAL KUMAR JHA
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptxVijalJain3
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)Jay Patel
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.pptcitizen15
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]Rome468
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsITNet
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTnikshaikh786
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptxPadmaN24
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++Amresh Raj
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperLee Greffin
 

Similar a OOP Concepts Explained: Classes, Objects, Inheritance and Polymorphism (20)

Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
 
C++ programing lanuage
C++ programing lanuageC++ programing lanuage
C++ programing lanuage
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
UNIT1-JAVA.pptx
UNIT1-JAVA.pptxUNIT1-JAVA.pptx
UNIT1-JAVA.pptx
 
My c++
My c++My c++
My c++
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptx
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
 

Último

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

Último (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

OOP Concepts Explained: Classes, Objects, Inheritance and Polymorphism

  • 1. Object-Oriented Programming(OOP) 1 PRANJAL SAINI (LECTURER) B.E.,M.TECH.,MBA
  • 2.
  • 3.
  • 4.
  • 5. The most common block symbols are:
  • 6.
  • 7. A flowchart representation of the algorithm for the above problem can be as follows:
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Advantages of the Top-Down Design Method • It is easier to comprehend the solution of a smaller and less complicated problem than to grasp the solution of a large and complex problem. • It is easier to test segments of solutions, rather than the entire solution at once. This method allows one to test the solution of each sub-problem separately until the entire solution has been tested. • It is often possible to simplify the logical steps of each sub- problem, so that when taken as a whole, the entire solution has less complex logic and hence easier to develop. • A simplified solution takes less time to develop and will be more readable. • The program will be easier to maintain.
  • 16.
  • 17.
  • 18. Structure of a Class in C++ class name { declarations constructor definition(s) method definitions } attributes and symbolic constants how to create and initialize objects how to manipulate the state of objects These parts of a class can actually be in any order
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. Polymorphism World India China USA Rajasthan New delhi Washington New york
  • 24.
  • 25. Base class Flower Rose Rajasthan Jaipur World India Derived class Single level Multi level Multiple Base class Derived class Bird Parrot Sparrow
  • 26. Class A { }; Class B:public A { }; Class C:public B { }; Class D: public C { }; Multi level Class A { }; Class B { }; Class C:public A, Public B { }; Multiple Class base { Data members and Functions; }; Class derived:public base { Data members and functions; }; Single Level
  • 27. Hierarchical Inheritance A B C D E F I H G J
  • 28. I Half(Hierarchical) II Half (Multiple ) Hybrid Hybrid = Hierarchical + Multiple Class D Class A Class B Class C Hybrid = Multi level+ Multiple Class D Class B Class C Class A Class C Class B Class D Class B Class C Class A
  • 29. Ex. of Inheritance RTU Engg. college ECE Deptt. EE Deptt. CS Deptt. Civil Deptt. Parent class Child class Sub classes of child class
  • 30.
  • 31. Encapsulation Encapsulation is the mechanism that binds the data & function in one form known as class. The data & function may be private or public.
  • 32. Objects binds together in form of a Class… Animal Dog Cat Fish Mutt Poodle Gold Beta
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. C++ Data types S. No DATA TYPE Size (in bytes) RANGE 1 Short int 2 -32768 to +32767 2 Unsigned short int 2 0 to 65535 3 long int 4 -2147483648 to 2147483647 4 Float 4 3.4e-38 to 3.4e+38 5 Char 1 -128 to 127 6 Unsigned char 1 0 to 255 7 Unsigned long int 4 0 to 4294967295 8 Double 8 1.7e-308 to 1.7e+308 9 Long double 10 1.7e-308 to 1.7e+308
  • 38.
  • 39. C++ Constants Non Numeric constants Numeric Constants Real Constants Integer Constants String Constants Character Constants Decimal, Octal, Hex
  • 40. C++ Operators S. No OPERATORS SYMBOLS 1. Arithmetic +,-,/,*,% 2. Logical &&,||,! 3. Relational <,>,>=,<=,==,!= 4. Assignment = 5. Increment ++ 6. Decrement -- 7. Comma , 8. Conditional (Ternary) ?: 9. Bitwise &,|,^,!,>>,<< 10. Special Operator Sizeof 11. Extraction >> 12. Insertion << 13. Dynamic Memory Allocator New 14. Dynamic memory De-allocator Delete
  • 41.
  • 42.
  • 43.
  • 44. Stream Input/Output Keyboard Console Unit INDIA INDIA Stream Input Stream Output
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50. cin>>row1; cout<<&quot;enter column for first matrix&quot;; cin>>col1; cout<<&quot;enter elements of first matrix&quot;; for(i=0;i<row1;i++) { for(j=0;j<col1;j++) { cin>>mat1[i][j]; } } cout<<&quot;enter the row of second matrix&quot;; cin>>row2; cout<<&quot;enter column for second matrix&quot;; cin>>col2; cout<<&quot;enter elements of second matrix&quot;;
  • 51. for(i=0;i<row2;i++) { for(j=0;j<col2;j++) { cin>>mat2[i][j]; } } if(col1==row2) { cout<<&quot;multiplication of matrices is&quot;; for(i=0;i<row1;i++) { for(j=0;j<col1;j++) {
  • 52. multi[i][j]=0; for(k=0;k<col1;k++) { multi[i][j]+=mat1[i][k]*mat2[k][j]; } cout<<multi[i][j]; } cout<<endl; } } else cout<<&quot;multiplication is not compatible&quot;; getch(); }
  • 53.
  • 54.
  • 55. “ HAVE A NICE DAY”