SlideShare uma empresa Scribd logo
1 de 73
Object Oriented Programming Department  of Computer Science, University of Peshawar Lecture 03 Introduction Introduction Lec - 03
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Abstraction ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Abstraction ,[object Object],[object Object],[object Object],Lecture 02 Introduction Department  of Computer Science, University of Peshawar Lecture 03 Introduction
Example - Abstraction ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example - Abstraction ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example - Abstraction ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example - Abstraction ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Abstraction - Advantage ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Class ,[object Object]
Example - Class ,[object Object],[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example - Class ,[object Object],[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Declaration of an Object class Rectangle { private:   int width;   int length; public:   void set(int w, int l);   int area(); } main() {   Rectangle r1; r1.set(5, 8);  } r1 is statically allocated width length r1 width = 5 length = 8 Lecture 03 Introduction
Difference Between Object And Class ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Difference Between Object And Class (continue) ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Inheritance ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Inheritance in classes ,[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example - Inheritance Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Teacher Student Doctor
Inheritance Concept Rectangle Triangle Polygon class Polygon { private:   int width, length; public:   void set(int w, int l); } class Rectangle{ private:   int width, length; public:   void set(int w, int l);   int area(); } class Triangle{ private:   int width, length; public:   void set(int w, int l);   int area(); } Lecture 03 Introduction
Inheritance Concept Rectangle Triangle Polygon class Polygon { protected:   int width, length; public:   void set(int w, int l); } class Rectangle : public Polygon { public:   int area(); } class Rectangle{ protected:   int width, length; public:   void set(int w, int l);   int area(); } Lecture 03 Introduction
Inheritance Concept Rectangle Triangle Polygon class Polygon { protected:   int width, length; public:   void set(int w, int l); } class Triangle : public Polygon { public: int area(); } class Triangle{ protected:   int width, length; public:   void set(int w, int l);   int area(); } Lecture 03 Introduction
Inheritance Concept Point Circle 3D-Point class Point { protected:   int x, y; public:   void set(int a, int b); } class Circle : public Point { private:  double r; } class 3D-Point: public Point { private:  int z; } x y x y r x y z Lecture 03 Introduction
[object Object],[object Object],Inheritance Concept RealNumber ComplexNumber ImaginaryNumber Rectangle Triangle Polygon Point Circle real imag real imag 3D-Point Lecture 03 Introduction
Inheritance – “IS A” or “IS A KIND OF” Relationship ,[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example – “IS A” Relatioship Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
Example – “IS A” Relatioship Lecture 03 Introduction Department  of Computer Science, University of Peshawar shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
Inheritance – Advantages ,[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Reuse with  Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example Reuse Lecture 03 Introduction Department  of Computer Science, University of Peshawar Shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
Example – “IS A” Relatioship Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
Example – “IS A” Relatioship Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
Example Reuse Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
Concepts Related with Inheritance ,[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Generalization ,[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example Generalization Lecture 03 Introduction Department  of Computer Science, University of Peshawar Student Name Age gender Program Study_year Eat walk Study Heldexam Teacher Name age gender designation salary Eat walk Teach Take_exam Doctor Name Age gender designation salary Eat walk Check up prescribe
Example - Generalization Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
Sub-typing & Specialization ,[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example – Sub-typing (Extension) Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam
Specialization (Restriction) ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example – Specialization (Restriction) Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Age: [0…..100] Set Age(a) Adult Age: [18….100] Set Age(a) Age = a If age<18 Error Else Age = a
Example – Specialization (Restriction) Lecture 03 Introduction Department  of Computer Science, University of Peshawar integerSet ---------- Add ( element) Natural Set ------- Add ( element) Add element  To the set If element<1 Error Else Add element to the  set
Method Overriding ,[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
… Method Overriding.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example – Specific Behavior Lecture 03 Introduction Department  of Computer Science, University of Peshawar shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
Example – Improve Performance Lecture 03 Introduction Department  of Computer Science, University of Peshawar Shape color coord draw Rotate Set color Circle redius Draw Rotate ,[object Object],[object Object],[object Object],[object Object],[object Object]
Abstract Classes ,[object Object],[object Object],[object Object],[object Object],Lecture 03 Introduction Department  of Computer Science, University of Peshawar
Example – Abstract Classes Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Teacher Doctor ,[object Object]
Concrete Classes ,[object Object],[object Object],[object Object],Lecture 03 Introduction
Example – Concrete Classes Lecture 03 Introduction Department  of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Teacher Doctor ,[object Object],Program Study Year Study Held Exam
Types of Inheritance ,[object Object],[object Object],[object Object],[object Object]
Types of Inheritance
Multiple Inheritance ,[object Object],[object Object]
Example – Multiple Inheritance
Example – Multiple Inheritance Land Vehicle Vehicle Water Vehicle Car Amphibious Vehicle Boot
Problems with multiple  Inheritance ,[object Object],[object Object],[object Object]
… Problems with multiple  Inheritance… ,[object Object],[object Object]
..Problems with multiple  Inheritance..
Solution – Override the common Feature ,[object Object],Land Vehicle Change Gear Water Vehicle Car Amphibious Vehicle Boot Vehicle
Composition – “has-a” relationship ,[object Object],[object Object],[object Object]
Example – Composition of Ali ,[object Object],[object Object],[object Object],[object Object],Head Ali Arms legs Head
Example – Composition of chair ,[object Object],[object Object],Lecture 03 Introduction Back Chair Arm seat Leg
Composition is Stronger ,[object Object],[object Object],[object Object],[object Object]
Example - Composition is Stronger ,[object Object],[object Object]
Example - Composition is Stronger ,[object Object],[object Object]
Aggregation ,[object Object],[object Object],[object Object]
Example – Aggregation ,[object Object],[object Object],[object Object],[object Object],Bed Room Chair Table Cupboard
Aggregation ,[object Object],[object Object]
Aggregation ,[object Object],[object Object],[object Object]
Aggregation is weaker ,[object Object],[object Object],[object Object],[object Object]
Example - Aggregation is weaker ,[object Object],[object Object]
Quizz (time-10 mins) ,[object Object],[object Object]
[object Object],Thanks Lecture 03 Introduction

Mais conteúdo relacionado

Destaque

The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship modelJane Garay
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Isuru Perera
 
OOP programming
OOP programmingOOP programming
OOP programminganhdbh
 
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)Beat Signer
 
Object Oriented Programming - Introduction
Object Oriented Programming - IntroductionObject Oriented Programming - Introduction
Object Oriented Programming - IntroductionDudy Ali
 
Engineering kpi examples
Engineering kpi examplesEngineering kpi examples
Engineering kpi examplesgallaravumartin
 
The opportunity in computer science
The opportunity in computer scienceThe opportunity in computer science
The opportunity in computer scienceHadi Partovi
 
Seminar on 3 d internet
Seminar on 3 d internetSeminar on 3 d internet
Seminar on 3 d internetPabitra Padhy
 
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Beat Signer
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?Colin Riley
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonSujith Kumar
 
Lecture 10 distributed database management system
Lecture 10   distributed database management systemLecture 10   distributed database management system
Lecture 10 distributed database management systememailharmeet
 

Destaque (20)

The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
 
Software Basics
Software BasicsSoftware Basics
Software Basics
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
 
OOP programming
OOP programmingOOP programming
OOP programming
 
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
NoSQL Databases - Lecture 12 - Introduction to Databases (1007156ANR)
 
Unit 02 dbms
Unit 02 dbmsUnit 02 dbms
Unit 02 dbms
 
Database design
Database designDatabase design
Database design
 
Object Oriented Programming - Introduction
Object Oriented Programming - IntroductionObject Oriented Programming - Introduction
Object Oriented Programming - Introduction
 
Engineering kpi examples
Engineering kpi examplesEngineering kpi examples
Engineering kpi examples
 
The opportunity in computer science
The opportunity in computer scienceThe opportunity in computer science
The opportunity in computer science
 
10 Myths for Computer Science
10 Myths for Computer Science10 Myths for Computer Science
10 Myths for Computer Science
 
Seminar on 3 d internet
Seminar on 3 d internetSeminar on 3 d internet
Seminar on 3 d internet
 
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to...
 
What does OOP stand for?
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Bhim app
Bhim appBhim app
Bhim app
 
What is OOP?
What is OOP?What is OOP?
What is OOP?
 
Lecture 10 distributed database management system
Lecture 10   distributed database management systemLecture 10   distributed database management system
Lecture 10 distributed database management system
 

Semelhante a Oop Introduction

OOAD - UML - Class and Object Diagrams - Lab
OOAD - UML - Class and Object Diagrams - LabOOAD - UML - Class and Object Diagrams - Lab
OOAD - UML - Class and Object Diagrams - LabVicter Paul
 
Helping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSHelping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSMartin Homik
 
Ail apresentation(kumazawa)
Ail apresentation(kumazawa)Ail apresentation(kumazawa)
Ail apresentation(kumazawa)TakaKumazawa
 
Student self-assessment of the development of advanced scientific thinking sk...
Student self-assessment of the development of advanced scientific thinking sk...Student self-assessment of the development of advanced scientific thinking sk...
Student self-assessment of the development of advanced scientific thinking sk...Kirsten Zimbardi
 
Ibdp physics exetended essay and army ppt.pptx
Ibdp physics exetended essay and army ppt.pptxIbdp physics exetended essay and army ppt.pptx
Ibdp physics exetended essay and army ppt.pptxAarti Akela
 
Core java complete notes - PAID call at +91-814-614-5674
Core java complete notes - PAID call at +91-814-614-5674Core java complete notes - PAID call at +91-814-614-5674
Core java complete notes - PAID call at +91-814-614-5674WebKrit Infocom
 
eLearning in practice in Higher Education by Prof. Edward Reeve
eLearning in practice in Higher Education by Prof. Edward ReeveeLearning in practice in Higher Education by Prof. Edward Reeve
eLearning in practice in Higher Education by Prof. Edward ReeveDr Poonsri Vate-U-Lan
 
Java căn bản - Chapter13
Java căn bản - Chapter13Java căn bản - Chapter13
Java căn bản - Chapter13Vince Vo
 
Chapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismChapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismEduardo Bergavera
 
Wi13 Workshop - Teaching as Research
Wi13 Workshop - Teaching as ResearchWi13 Workshop - Teaching as Research
Wi13 Workshop - Teaching as ResearchPeter Newbury
 
Inheritance & Polymorphism - 1
Inheritance & Polymorphism - 1Inheritance & Polymorphism - 1
Inheritance & Polymorphism - 1PRN USM
 
Technology Integration
Technology IntegrationTechnology Integration
Technology Integrationjjaffe
 
Light structural systems_for_covering_large_spans
Light structural systems_for_covering_large_spansLight structural systems_for_covering_large_spans
Light structural systems_for_covering_large_spansAditya Sanyal
 
Dynamic Question Answer Generator An Enhanced Approach to Question Generation
Dynamic Question Answer Generator An Enhanced Approach to Question GenerationDynamic Question Answer Generator An Enhanced Approach to Question Generation
Dynamic Question Answer Generator An Enhanced Approach to Question Generationijtsrd
 
Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Uzair Salman
 

Semelhante a Oop Introduction (20)

OOAD - UML - Class and Object Diagrams - Lab
OOAD - UML - Class and Object Diagrams - LabOOAD - UML - Class and Object Diagrams - Lab
OOAD - UML - Class and Object Diagrams - Lab
 
Eclass Model
Eclass ModelEclass Model
Eclass Model
 
Helping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMSHelping Students to Learn Matehmatics Beyond LMS
Helping Students to Learn Matehmatics Beyond LMS
 
Ail apresentation(kumazawa)
Ail apresentation(kumazawa)Ail apresentation(kumazawa)
Ail apresentation(kumazawa)
 
Student self-assessment of the development of advanced scientific thinking sk...
Student self-assessment of the development of advanced scientific thinking sk...Student self-assessment of the development of advanced scientific thinking sk...
Student self-assessment of the development of advanced scientific thinking sk...
 
Ibdp physics exetended essay and army ppt.pptx
Ibdp physics exetended essay and army ppt.pptxIbdp physics exetended essay and army ppt.pptx
Ibdp physics exetended essay and army ppt.pptx
 
Core java complete notes - PAID call at +91-814-614-5674
Core java complete notes - PAID call at +91-814-614-5674Core java complete notes - PAID call at +91-814-614-5674
Core java complete notes - PAID call at +91-814-614-5674
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
CURRICULUM VITAE
CURRICULUM VITAECURRICULUM VITAE
CURRICULUM VITAE
 
eLearning in practice in Higher Education by Prof. Edward Reeve
eLearning in practice in Higher Education by Prof. Edward ReeveeLearning in practice in Higher Education by Prof. Edward Reeve
eLearning in practice in Higher Education by Prof. Edward Reeve
 
Java căn bản - Chapter13
Java căn bản - Chapter13Java căn bản - Chapter13
Java căn bản - Chapter13
 
Chapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismChapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and Polymorphism
 
Wi13 Workshop - Teaching as Research
Wi13 Workshop - Teaching as ResearchWi13 Workshop - Teaching as Research
Wi13 Workshop - Teaching as Research
 
Inheritance & Polymorphism - 1
Inheritance & Polymorphism - 1Inheritance & Polymorphism - 1
Inheritance & Polymorphism - 1
 
Technology Integration
Technology IntegrationTechnology Integration
Technology Integration
 
ICTERI-2021-seidametova.pdf
ICTERI-2021-seidametova.pdfICTERI-2021-seidametova.pdf
ICTERI-2021-seidametova.pdf
 
Light structural systems_for_covering_large_spans
Light structural systems_for_covering_large_spansLight structural systems_for_covering_large_spans
Light structural systems_for_covering_large_spans
 
Dynamic Question Answer Generator An Enhanced Approach to Question Generation
Dynamic Question Answer Generator An Enhanced Approach to Question GenerationDynamic Question Answer Generator An Enhanced Approach to Question Generation
Dynamic Question Answer Generator An Enhanced Approach to Question Generation
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes
 

Último

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
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
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
 
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
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Último (20)

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
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
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...
 
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)
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Oop Introduction

  • 1. Object Oriented Programming Department of Computer Science, University of Peshawar Lecture 03 Introduction Introduction Lec - 03
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Lecture 03 Introduction Department of Computer Science, University of Peshawar
  • 14. Declaration of an Object class Rectangle { private: int width; int length; public: void set(int w, int l); int area(); } main() { Rectangle r1; r1.set(5, 8); } r1 is statically allocated width length r1 width = 5 length = 8 Lecture 03 Introduction
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Example - Inheritance Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Teacher Student Doctor
  • 20. Inheritance Concept Rectangle Triangle Polygon class Polygon { private: int width, length; public: void set(int w, int l); } class Rectangle{ private: int width, length; public: void set(int w, int l); int area(); } class Triangle{ private: int width, length; public: void set(int w, int l); int area(); } Lecture 03 Introduction
  • 21. Inheritance Concept Rectangle Triangle Polygon class Polygon { protected: int width, length; public: void set(int w, int l); } class Rectangle : public Polygon { public: int area(); } class Rectangle{ protected: int width, length; public: void set(int w, int l); int area(); } Lecture 03 Introduction
  • 22. Inheritance Concept Rectangle Triangle Polygon class Polygon { protected: int width, length; public: void set(int w, int l); } class Triangle : public Polygon { public: int area(); } class Triangle{ protected: int width, length; public: void set(int w, int l); int area(); } Lecture 03 Introduction
  • 23. Inheritance Concept Point Circle 3D-Point class Point { protected: int x, y; public: void set(int a, int b); } class Circle : public Point { private: double r; } class 3D-Point: public Point { private: int z; } x y x y r x y z Lecture 03 Introduction
  • 24.
  • 25.
  • 26. Example – “IS A” Relatioship Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
  • 27. Example – “IS A” Relatioship Lecture 03 Introduction Department of Computer Science, University of Peshawar shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
  • 28.
  • 29.
  • 30. Example Reuse Lecture 03 Introduction Department of Computer Science, University of Peshawar Shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
  • 31. Example – “IS A” Relatioship Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
  • 32. Example – “IS A” Relatioship Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
  • 33. Example Reuse Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
  • 34.
  • 35.
  • 36. Example Generalization Lecture 03 Introduction Department of Computer Science, University of Peshawar Student Name Age gender Program Study_year Eat walk Study Heldexam Teacher Name age gender designation salary Eat walk Teach Take_exam Doctor Name Age gender designation salary Eat walk Check up prescribe
  • 37. Example - Generalization Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam Teacher designation salary Teach Take_exam Doctor designation salary Check up prescribe
  • 38.
  • 39. Example – Sub-typing (Extension) Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Name Age Gender Eat walk Student Program Study_year Study Heldexam
  • 40.
  • 41. Example – Specialization (Restriction) Lecture 03 Introduction Department of Computer Science, University of Peshawar Person Age: [0…..100] Set Age(a) Adult Age: [18….100] Set Age(a) Age = a If age<18 Error Else Age = a
  • 42. Example – Specialization (Restriction) Lecture 03 Introduction Department of Computer Science, University of Peshawar integerSet ---------- Add ( element) Natural Set ------- Add ( element) Add element To the set If element<1 Error Else Add element to the set
  • 43.
  • 44.
  • 45. Example – Specific Behavior Lecture 03 Introduction Department of Computer Science, University of Peshawar shape color coordinates Draw rotate Set color Circle radius draw Compute area Line length Draw Triangle angle Draw Compute area
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 53.
  • 54. Example – Multiple Inheritance
  • 55. Example – Multiple Inheritance Land Vehicle Vehicle Water Vehicle Car Amphibious Vehicle Boot
  • 56.
  • 57.
  • 58. ..Problems with multiple Inheritance..
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.