SlideShare a Scribd company logo
1 of 21
Object Oriented Programming
Development

            By:
           Marc Conrad
           University of Luton

            Email:
            Marc.Conrad@luton.ac.uk
            Room:
                   D104
                             1
What are we doing today?

 Introduction of:
   the lecturer
   Objects
   Basic Terminology
   C++
   the module



                       2
What is Object Oriented
Programming?

                      Identifying objects and
                      assigning responsibilities to
                      these objects.
                      Objects communicate to
An object is like a
                      other objects by sending
  black box.
                      messages.
The internal
                      Messages are received by
  details are
                      the methods of an object
  hidden.

                                         3
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, …



                                  4
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.
                                      5
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.
                                 6
Example: The Person class
#include<string>
#include<iostream>
class Person{
   char name[20];
                                           private
   int yearOfBirth;                         data
public:
   void displayDetails() {
           cout << name << " born in "
                 << yearOfBirth << endl;          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.


           =                 +
                                      8
Basic Terminology

 Abstraction is the representation of the
 essential features of an object. These are
 ‘encapsulated’ into an abstract data type.
 Encapsulation is the practice of including
 in an object everything it needs hidden
 from other objects. The internal state is
 usually not accessible by other objects.

                                  9
Basic Terminology:
Inheritance

 Inheritance means that one class inherits
 the characteristics of another class.
 This is also called a “is a” relationship:

 A car is a vehicle
                          A dog is an animal
  A teacher is a person
                                  10
Basic Terminology:
Polymorphism

 Polymorphism means “having many
 forms”. It allows different objects to
 respond to the same message in different
 ways, the response specific to the type of
 the object.
  E.g. the message displayDetails() of the
  Person class should give different
  results when send to a Student object
  (e.g. the enrolment number).
                                  11
Basic Terminology:
Aggregation

 Aggregation describes a “has a”
 relationship. One object is a part of
 another object.        A car has wheels.

 We distinguish between composite
 aggregation (the composite “owns” the
 part) and shared aggregation (the part is
 shared by more then one composite).
                                  12
Basic Terminology:
Behaviour and Messages

 The most important aspect of an object is
 its behaviour (the things it can do). A
 behaviour is initiated by sending a
 message to the object (usually by calling
 a method).




                                 13
The two steps of Object
Oriented Programming

 Making Classes: Creating, extending or
 reusing abstract data types.

 Making Objects interact: Creating objects
 from abstract data types and defining their
 relationships.



                                  14
Historical Notes
 C++ owes most to C.
 Other ancestors are Simula67
 and Algol68.                        C++ 1987

 First versions of C++ in 1980 under the
 name “C with classes”. Since 1983 the
 name C++ is used.
 1990: ANSI/ISO 9899 defines a standard
 for C
 1998: ISO/IEC 14882 specifies the
                                  15
 standard for C++
C++ and C

 C is a subset of C++.
 Advantages: Existing C libraries can be
 used, efficient code can be generated.
 But: C++ has the same caveats and
 problems as C (e.g. pointer arithmetic,…).
 C++ can be used both as a low level and
 as a high level language.
                                      n th e
                           e fo cus o ects.
                         W         l asp
                               leve 16
                         hi gh
C++ and Java

 Java is a full object oriented language, all
 code has to go into classes.
 C++ - in contrast - is a hybrid language,
 capable both of functional and object
 oriented programming.

       So, C++ is more powerful but also
       more difficult to handle than Java.
                                    17
Module Outline

 Introduction        Inheritance
 The non object      Aggregation
 oriented basics     Polymorphism
 Classes             Multifile Development
 Design Approaches
 Testing




                               18
Assessment Details

 50% in course and 50% exam.
 For more details for the in course
 assignment see separate handout.




                                 19
Books

 Teach Yourself C++ in 10 minutes,
 J. Liberty, SAMS 1999.
 C++ - How to program, Deitel & Deitel,
 Prentice Hall, 2001.
 Object Oriented Programming with C++,
 David Parson, Letts Educational, London
 1997.

                                20
Websites

 A C++ online tutorial:
 http://www.cplusplus.com/doc/tutorial/
 The C++ FAQ:
 http://www.parashift.com/c++-faq-lite
 The homepage of Bjarne Stroustrup, the
 inventor of C++:
 http://www.research.att.com/~bs

                                    ny m ore!
                          ma n y, ma
                   A nd
                                   21

More Related Content

What's hot

Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programmingAbzetdin Adamov
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented ProgrammingAida Ramlan II
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented TechnologiesUmesh Nikam
 
C# programming : Chapter One
C# programming : Chapter OneC# programming : Chapter One
C# programming : Chapter OneKhairi Aiman
 
Introduction to oop using java
Introduction  to oop using java Introduction  to oop using java
Introduction to oop using java omeed
 
Object Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIObject Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIAjit Nayak
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsEPAM
 
OntoLex-TEI: Inspiration from Global WordNet
OntoLex-TEI: Inspiration from Global WordNetOntoLex-TEI: Inspiration from Global WordNet
OntoLex-TEI: Inspiration from Global WordNetPretaLLOD
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop Kumar
 
Lecture01 object oriented-programming
Lecture01 object oriented-programmingLecture01 object oriented-programming
Lecture01 object oriented-programmingHariz Mustafa
 
Introduction to oop with c++
Introduction to oop with c++Introduction to oop with c++
Introduction to oop with c++Shruti Patel
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
OOPS with C++ | Concepts of OOPS | Introduction
OOPS with C++ | Concepts of OOPS | IntroductionOOPS with C++ | Concepts of OOPS | Introduction
OOPS with C++ | Concepts of OOPS | IntroductionADITYATANDONKECCSE
 
Pursuing Domain-Driven Design practices in PHP
Pursuing Domain-Driven Design practices in PHPPursuing Domain-Driven Design practices in PHP
Pursuing Domain-Driven Design practices in PHPGiorgio Sironi
 
itft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in javaitft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in javaAtul Sehdev
 
Chapter 6 OOPS Concept
Chapter 6 OOPS ConceptChapter 6 OOPS Concept
Chapter 6 OOPS ConceptAmrit Kaur
 

What's hot (20)

General oops concepts
General oops conceptsGeneral oops concepts
General oops concepts
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
 
the Concept of Object-Oriented Programming
the Concept of Object-Oriented Programmingthe Concept of Object-Oriented Programming
the Concept of Object-Oriented Programming
 
Object Oriented Technologies
Object Oriented TechnologiesObject Oriented Technologies
Object Oriented Technologies
 
C# programming : Chapter One
C# programming : Chapter OneC# programming : Chapter One
C# programming : Chapter One
 
Introduction to oop using java
Introduction  to oop using java Introduction  to oop using java
Introduction to oop using java
 
Testing in isolation
Testing in isolationTesting in isolation
Testing in isolation
 
Object Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIObject Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part II
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real Projects
 
Java
JavaJava
Java
 
OntoLex-TEI: Inspiration from Global WordNet
OntoLex-TEI: Inspiration from Global WordNetOntoLex-TEI: Inspiration from Global WordNet
OntoLex-TEI: Inspiration from Global WordNet
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
 
Lecture01 object oriented-programming
Lecture01 object oriented-programmingLecture01 object oriented-programming
Lecture01 object oriented-programming
 
Introduction to oop with c++
Introduction to oop with c++Introduction to oop with c++
Introduction to oop with c++
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
OOPS with C++ | Concepts of OOPS | Introduction
OOPS with C++ | Concepts of OOPS | IntroductionOOPS with C++ | Concepts of OOPS | Introduction
OOPS with C++ | Concepts of OOPS | Introduction
 
Pursuing Domain-Driven Design practices in PHP
Pursuing Domain-Driven Design practices in PHPPursuing Domain-Driven Design practices in PHP
Pursuing Domain-Driven Design practices in PHP
 
itft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in javaitft-Fundamentals of object–oriented programming in java
itft-Fundamentals of object–oriented programming in java
 
Chapter 6 OOPS Concept
Chapter 6 OOPS ConceptChapter 6 OOPS Concept
Chapter 6 OOPS Concept
 

Similar to Week1

Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesJessica Deakin
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.pptTigistTilahun1
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptxAbhilashTom4
 
1 intro
1 intro1 intro
1 introabha48
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptxPadmaN24
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingsana younas
 
C++ with student management system project
C++ with student management system projectC++ with student management system project
C++ with student management system projectKratik Khandelwal
 
Oops concepts in c++ documentation
Oops concepts in c++ documentationOops concepts in c++ documentation
Oops concepts in c++ documentationfarouq umar
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesFellowBuddy.com
 
Oop.concepts
Oop.conceptsOop.concepts
Oop.conceptstahir266
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++AkshtaSuryawanshi
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)SURBHI SAROHA
 
C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three noskrismishra
 

Similar to Week1 (20)

Object And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) LanguagesObject And Oriented Programing ( Oop ) Languages
Object And Oriented Programing ( Oop ) Languages
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Chapter 1- Introduction.ppt
Chapter 1- Introduction.pptChapter 1- Introduction.ppt
Chapter 1- Introduction.ppt
 
JAVA PROGRAMMING
JAVA PROGRAMMING JAVA PROGRAMMING
JAVA PROGRAMMING
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
 
1 intro
1 intro1 intro
1 intro
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Java pdf
Java   pdfJava   pdf
Java pdf
 
C++ with student management system project
C++ with student management system projectC++ with student management system project
C++ with student management system project
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
Oops concepts in c++ documentation
Oops concepts in c++ documentationOops concepts in c++ documentation
Oops concepts in c++ documentation
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
 
Oop.concepts
Oop.conceptsOop.concepts
Oop.concepts
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
 
C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three nos
 

Recently uploaded

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

Week1

  • 1. Object Oriented Programming Development By: Marc Conrad University of Luton Email: Marc.Conrad@luton.ac.uk Room: D104 1
  • 2. What are we doing today? Introduction of: the lecturer Objects Basic Terminology C++ the module 2
  • 3. What is Object Oriented Programming? Identifying objects and assigning responsibilities to these objects. Objects communicate to An object is like a other objects by sending black box. messages. The internal Messages are received by details are the methods of an object hidden. 3
  • 4. 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, … 4
  • 5. 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. 5
  • 6. 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. 6
  • 7. Example: The Person class #include<string> #include<iostream> class Person{ char name[20]; private int yearOfBirth; data public: void displayDetails() { cout << name << " born in " << yearOfBirth << endl; public } processes //... };
  • 8. 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. = + 8
  • 9. Basic Terminology Abstraction is the representation of the essential features of an object. These are ‘encapsulated’ into an abstract data type. Encapsulation is the practice of including in an object everything it needs hidden from other objects. The internal state is usually not accessible by other objects. 9
  • 10. Basic Terminology: Inheritance Inheritance means that one class inherits the characteristics of another class. This is also called a “is a” relationship: A car is a vehicle A dog is an animal A teacher is a person 10
  • 11. Basic Terminology: Polymorphism Polymorphism means “having many forms”. It allows different objects to respond to the same message in different ways, the response specific to the type of the object. E.g. the message displayDetails() of the Person class should give different results when send to a Student object (e.g. the enrolment number). 11
  • 12. Basic Terminology: Aggregation Aggregation describes a “has a” relationship. One object is a part of another object. A car has wheels. We distinguish between composite aggregation (the composite “owns” the part) and shared aggregation (the part is shared by more then one composite). 12
  • 13. Basic Terminology: Behaviour and Messages The most important aspect of an object is its behaviour (the things it can do). A behaviour is initiated by sending a message to the object (usually by calling a method). 13
  • 14. The two steps of Object Oriented Programming Making Classes: Creating, extending or reusing abstract data types. Making Objects interact: Creating objects from abstract data types and defining their relationships. 14
  • 15. Historical Notes C++ owes most to C. Other ancestors are Simula67 and Algol68. C++ 1987 First versions of C++ in 1980 under the name “C with classes”. Since 1983 the name C++ is used. 1990: ANSI/ISO 9899 defines a standard for C 1998: ISO/IEC 14882 specifies the 15 standard for C++
  • 16. C++ and C C is a subset of C++. Advantages: Existing C libraries can be used, efficient code can be generated. But: C++ has the same caveats and problems as C (e.g. pointer arithmetic,…). C++ can be used both as a low level and as a high level language. n th e e fo cus o ects. W l asp leve 16 hi gh
  • 17. C++ and Java Java is a full object oriented language, all code has to go into classes. C++ - in contrast - is a hybrid language, capable both of functional and object oriented programming. So, C++ is more powerful but also more difficult to handle than Java. 17
  • 18. Module Outline Introduction Inheritance The non object Aggregation oriented basics Polymorphism Classes Multifile Development Design Approaches Testing 18
  • 19. Assessment Details 50% in course and 50% exam. For more details for the in course assignment see separate handout. 19
  • 20. Books Teach Yourself C++ in 10 minutes, J. Liberty, SAMS 1999. C++ - How to program, Deitel & Deitel, Prentice Hall, 2001. Object Oriented Programming with C++, David Parson, Letts Educational, London 1997. 20
  • 21. Websites A C++ online tutorial: http://www.cplusplus.com/doc/tutorial/ The C++ FAQ: http://www.parashift.com/c++-faq-lite The homepage of Bjarne Stroustrup, the inventor of C++: http://www.research.att.com/~bs ny m ore! ma n y, ma A nd 21