UNIT - I
INTRODUCTION TO C++
1.2 EVOLUTION OF C++
• C++ IS AN OBJECT ORIENTED PROGRAMMING LANGUAGE AND EXTENSION OF C.
• BJARNE STROUSTRUP , MASTER OF SIMULA67 AND C COMBINED THE FEATURES
OF BOTH AND DEVELOPED A POWERFUL LANGUAGE THAT SUPPORTS OBJECT
ORIENTED PROGRAMMING WITH FEATURES OF C.
• STROUSTRUP CALLED THE NEW LANGUAGE AS “ C WITH CLASSES “ . IN 1983 IT
WAS NAMED AS C++.
• C++ IS A SUPERSET OF C.
1.2 EVOLUTION OF C++
1.3 THE ANSI STANDARD
• ANSI – AMERICAN NATIONAL STANDARDS INSTITUTE.
• INSTITUTE FOUNDED IN 1918 – GOAL OF THIS INSTITUTE WAS
• TO SUGGEST
• REFORM
• RECOMMEND
• AND PUBLISH STANDARDS FOR DATA PROCESSING IN USA.
• RECOGNIZED COUNCIL MADE INTERNATIONAL STANDARD FOR C++
• C++ IS ALSO REFERRED AS ISO STANDARD.
• FIRST DRAFT WAS MADE ON 25 JANUARY 1994.
• ANSI STANDARD ATTEMPT TO ENSURE THAT C++ IS PORTABLE.
1.7 PREFACE TO OBJECT ORIENTED
PROGRAMMING
• THE PROCEDURAL LANGUAGE DOES NOT ALLOW THE DATA TO FLOW FREELY
AROUND THE SYSTEMS
• TIES TO THE FUNCTIONS THAT OPERATE ON IT AND PREVENTS FROM
ACCIDENTAL CHANGE
• OOP PERMITS TO ANALYZE A PROBLEM INTO NUMBER OF ITEMS CALLED OBJECTS
AND ASSEMBLES DATA AND FUNCTIONS.
CHARACTERISTICS OF OOP
• OOP PAYS MORE IMPORTANCE OF DATA RATHER THAN FUNCTION
• PROGRAMS ARE DIVIDED INTO CLASSES AND THEIR MEMBER
FUNCTION
• OOP FOLLOWS BOTTOM UP APPROACH
• NEW DATA ITEMS AND FUNCTIONS CAN BE ADDED WHENEVER
NEEDED
• DATA IS PRIVATE AND PREVENTED FROM ACCESSING EXTERNAL
FUNCTIONS
• OBJECTS COMMUNICATE WITH EACH OTHER THROUGH FUNCTIONS
RELATION BETWEEN DATA AND MEMBER FUNCTIONS
IN OOP
OBJECT A OBJECT B OBJECT C
Data variables
Member
function
Data
variables
Member
function
Data variables
Member
function
Data variables
Member
function
Data variables
Member
function
Data variables
Member
function
1.8 KEY CONCEPTS OF OBJECT ORIENTED
PROGRAMMING`
OBJECT ORIENTED PARADIGM
C++
Encapsulati
on
Data
Abstraction
Inheritance
Polymorphi
sm
Delegation
Genericity
C++ CLASSES AND OBJECTS
• C++ IS AN OBJECT-ORIENTED PROGRAMMING LANGUAGE.
• EVERYTHING IN C++ IS ASSOCIATED WITH CLASSES AND OBJECTS,
ALONG WITH ITS ATTRIBUTES AND METHODS. FOR EXAMPLE. IN REAL
LIFE, A CAR IS AN OBJECT. THE CAR HAS ATTRIBUTES, SUCH AS WEIGHT
AND COLOR, AND METHODS, SUCH AS DRIVE AND BRAKE.
• ATTRIBUTES AND METHODS ARE
BASICALLY VARIABLES AND FUNCTIONS THAT BELONGS TO THE CLASS,
THESE ARE OFTEN REFERRED TO AS "CLASS MEMBERS".
• A CLASS IS A USER-DEFINED DATA TYPE THAT WE CAN USE IN OUR
PROGRAM, AND IT WORKS AS AN OBJECT CONSTRUCTOR, OR A
"BLUEPRINT" FOR CREATING OBJECTS.
(1) OBJECTS
• OBJECTS ARE PRIMARY RUNTIME ENTITIES IN OBJECT ORIENTED
PROGRAMMING
• EG. A SPOT , A PERSON , ANY DATA ITEM RELATED TO PROGRAM INCLUDING
USER-DEFINED DATA TYPES.
• OBJECTS OCCUPY SPACE IN MEMORY
• EVERY OBJECTS HAS ITS OWN PROPERTIES AND FEATURES
• CAN BE RECOGNIZED BY ITS NAME
OBJECTS
• OBJECTS COMMUNICATE WITH EACH OTHER BY SENDING MESSAGES.
• AN OBJECT CAN BE REPRESENTED BY
• THE NAME OF THE ABOVE OBJECT IS CITY
• ITS DATA MEMBERS ARE NAME_OF_CITY, POPULATION AND AREA
• VARIOUS FUNCTIONS ASSOCIATED WITH CITY ARE AVERAGE AGE ,
LITERACY_RATE AND DISPLAY
Object : City
Data :
Name_of_City
Population
Area
Functions :
Average age
Literacy_rate
Display
(2) CLASSES
• A CLASS IS A GROUPING OF OBJECTS THAT HAVE IDENTICAL PROPERTIES , COMMON
BEHAVIOR AND SHARED RELATIONSHIP
• A CLASS BINDS THE DATA AND ITS RELATED FUNCTIONS TOGETHER
• CLASS IDENTIFIES THE NATURE AND METHODS THAT ACT ON THE DATA STRUCTURE
AND ABSTRACT DATA TYPE
• GROUP OF DATA AND CODE OF AN OBJECT CAN BE BUILT AS USER-DEFINED DATA TYPE
BY USING CLASS.
• OBJECTS ARE NOTHING BUT VARIABLES OF TYPE CLASS.
• ONCE A CLASS IS CREATED , A NUMBER OF OBJECTS ASSOCIATED WITH THAT CLASS CAN
BE CREATED
• SYNTAX USED TO CREATE AN OBJECT IS SIMILAR TO CREATE AN INTEGER VARIABLE
• CLASS DEFINES CHARACTERISTIC AND ACTION OF OBJECTS
CLASSES AND THEIR PROPERTIES
CLASSES AND RELATED DATA
DATA TYPE AND ABSTRACT DATA TYPE
• THE DATA TYPE IS BASICALLY A TYPE OF DATA THAT CAN BE USED IN DIFFERENT
COMPUTER PROGRAM. IT SIGNIFIES THE TYPE LIKE INTEGER, FLOAT ETC, THE SPACE LIKE
INTEGER WILL TAKE 4-BYTES, CHARACTER WILL TAKE 1-BYTE OF SPACE ETC.
• THE ABSTRACT DATA TYPE IS SPECIAL KIND OF DATA TYPE, WHOSE BEHAVIOR IS DEFINED
BY A SET OF VALUES AND SET OF OPERATIONS. THE KEYWORD “ABSTRACT” IS USED AS WE
CAN USE THESE DATA TYPES, WE CAN PERFORM DIFFERENT OPERATIONS. BUT HOW
THOSE OPERATIONS ARE WORKING THAT IS TOTALLY HIDDEN FROM THE USER. THE ADT IS
MADE OF WITH PRIMITIVE DATA TYPES, BUT OPERATION LOGICS ARE HIDDEN.
• SOME EXAMPLES OF ADT ARE STACK, QUEUE, LIST ETC.
• LET US SEE SOME OPERATIONS OF THOSE MENTIONED ADT −
• STACK −
• ISFULL(), THIS IS USED TO CHECK WHETHER STACK IS FULL OR NOT
• ISEMPTY(), THIS IS USED TO CHECK WHETHER STACK IS EMPTY OR NOT
• PUSH(X), THIS IS USED TO PUSH X INTO THE STACK
• POP(), THIS IS USED TO DELETE ONE ELEMENT FROM TOP OF THE STACK
• QUEUE −
• ISFULL(), THIS IS USED TO CHECK WHETHER QUEUE IS FULL OR NOT
• ISEMPTY(), THIS IS USED TO CHECK WHETHER QUEUE IS EMPTY OR NOT
• INSERT(X), THIS IS USED TO ADD X INTO THE QUEUE AT THE REAR END
• DELETE(), THIS IS USED TO DELETE ONE ELEMENT FROM THE FRONT END OF THE
QUEUE
• SIZE(), THIS FUNCTION IS USED TO GET NUMBER OF ELEMENTS PRESENT INTO THE
QUEUE
• LIST −
• SIZE(), THIS FUNCTION IS USED TO GET NUMBER OF ELEMENTS PRESENT INTO THE
LIST
• INSERT(X), THIS FUNCTION IS USED TO INSERT ONE ELEMENT INTO THE LIST
• REMOVE(X), THIS FUNCTION IS USED TO REMOVE GIVEN ELEMENT FROM THE LIST
• GET(I), THIS FUNCTION IS USED TO GET ELEMENT AT POSITION I
• REPLACE(X, Y), THIS FUNCTION IS USED TO REPLACE X WITH Y VALUE
(3) METHOD
• AN OPERATION REQUIRED FOR AN OBJECT OR ENTITY WHEN CODED IN A CLASS
IS CALLED A METHOD
• OPERATIONS REQUIRED FOR AN OBJECT ARE TO BE DEFINED IN THE CLASS
• ALL OBJECTS CARRY CERTAIN ACTIONS OR OPERATIONS
• EACH ACTION NEEDS AN OBJECT THAT BECOMES A FUNCTION IN THE CLASS
THAT DEFINES IT AND IS REFERRED AS A METHOD
REPRESENTATION OF METHODS IN DIFFERENT
MANNERS
REPRESENTATION OF METHODS IN DIFFERENT
MANNERS
(4) DATA ABSTRACTION
• ABSTRACTION REFERS TO THE PROCEDURE OF REPRESENTING ESSENTIAL FEATURES
WITHOUT INCLUDING THE BACKGROUND DETAILS
• CLASSES USE THEORY OF ABSTRACTION AND ARE DEFINED AS LIST OF ABSTRACT
PROPERTIES
SUCH AS SIZE , COST , HEIGHT , AND FEW FUNCTIONS TO OPERATE ON THESE
PROPERTIES
• DATA ABSTRACTION - PROCEDURE FOR IDENTIFYING PROPERTIES AND METHODS
RELATED TO SPECIFIC ENTITY.
• DATA ABSTRACTION USED TO DEFINE A DATA TYPE AVAILABLE IN PROGRAMMING
LANGUAGE CALLED ABSTRACT DATA TYPE(ADT) – CONSISTS OF SET OF VALUES
AND SET OF OPERATIONS.
EG. DATA ABSTRACTION
(5) ENCAPSULATION
• THE PACKING OF DATA AND FUNCTIONS INTO A SINGLE COMPONENT
• C++ SUPPORTS ENCAPSULATION USING CLASSES
• DATA NOT REACHABLE BY OUTSIDE FUNCTION , ONLY THOSE FUNCTIONS THAT
ARE ABLE TO ACCESS THE DATA ARE DEFINED WITHIN THE CLASS
• THESE FUNCTIONS PREPARE INTERFACE BETWEEN OBJECTS DATA AND PROGRAM
• WITH ENCAPSULATION DATA HIDING IS POSSIBLE
• IMPORTANT FEATURE WHERE AN OBJECT CAN BE USED WITHOUT USER KNOWING
HOW IT WORKS INTERNALLY.
ENCAPSULATION
(6) INHERITANCE
• INHERITANCE IS THE METHOD BY WHICH OBJECTS OF ONE CLASS GET THE
PROPERTIES OF OBJECTS OF ANOTHER CLASS
• IN OOPS INHERITANCE PROVIDES REUSABILITY
• PROGRAMMER CAN ADD NEW PROPERTIES TO EXISTING CLASS WITHOUT
CHANGING IT
• THIS CAN BE ACHIEVED BY DERIVING A NEW CLASS FROM EXISTING CLASS
• THE NEW CLASS WILL HAVE FEATURES OF BOTH THE CLASSES
INHERITANCE
(7) POLYMORPHISM
• ALLOWS THE SAME FUNCTION TO ACT IN A DIFFERENT WAY IN DIFFERENT
CLASSES
• HOLDS THE ABILITY TO TAKE MORE THAN ONE FORM
POLYMORPHISM
(8) DYNAMIC BINDING
• BINDING MEANS CONNECTING ONE PROGRAM TO ANOTHER PROGRAM THAT IS
TO BE EXECUTED IN REPLY TO THE CALL.
• IS ALSO CALLED AS LATE BINDING
• CODE PRESENT IN SPECIFIED PROGRAM IS UNKNOWN TILL IT IS EXECUTED.
(9) MESSAGE PASSING
MESSAGE PASSING
(10) REUSABILITY
• ALLOWS REUSABILITY OF CLASSES BY EXTENDING THEM TO OTHER CLASSES USING
INHERITANCE
(11) DELEGATION
• TWO CLASSES CAN BE JOINED IN 2 WAYS
• INHERITANCE
• DELEGATION
 BOTH PROVIDE REUSABILITY OF CLASSES
 IN INHERITANCE ONE CLASS CAN BE DERIVED FROM OTHER CLASS
 RELATIONSHIP B/N 2 CLASSES- KIND OF RELATIONSHIP
 IF CLASS Y IS DERIVED FROM CLASS X THEN CLASS Y IS KNOWN AS KIND OF X
 WHEN OBJECT OF ONE CLASS IS USED AS DATA MEMBER IN THE OTHER CLASS –
COMPOSITION OF OBJECTS – DELEGATION
 EG. CLASS C HAS 2 DATA MEMBERS , THESE 2 DATA MEMBERS ARE OBJECTS OF
CLASS A AND B –RELATIONSHIP BETWEEN THESE CLASSES IS - HAS A
RELATIONSHIP
DELEGATION
(12) GENERICITY
• S/W COMPONENTS HAVE MORE THAN ONE VERSION DEPENDING ON DATA
TYPES OF ARGUMENTS
• THIS ALLOWS DECLARATION OF VARIABLES WITHOUT SPECIFYING EXACT DATA
TYPE
• COMPILER IDENTIFIES DATA TYPE AT RUNTIME
1.9 ADVANTAGES OF OOP
• CAN BE COMFORTABLY UPGRADED
• USING INHERITANCE , ELIMINATE REDUNDANT PROGRAM CODE AND CONTINUE
THE USE OF PREVIOUSLY DEFINED CLASSES
• DATA HIDING ENABLES PROGRAMMER TO DESIGN AND DEVELOP SAFE
PROGRAMS THAT DOES NOT DISTURB CODE IN OTHER PARTS OF PROGRAM
• ENCAPSULATION ALLOWS TO DEFINE THE CLASS WITH MANY FUNCTIONS AND
CHARACTERISTICS BUT ONLY FEW FUNCTIONS ARE EXPOSED TO USER
• ALLOWS TO CREATE EXTENDED AND REUSABLE PARTS
• OBJECTS COMMUNICATE WITH EACH OTHER AND PASS MESSAGES
• 1.10 OBJECT ORIENTED LANGUAGES SEE THE TABLE IN THE BOOK

Chapter - 1.pptx

  • 1.
  • 2.
    1.2 EVOLUTION OFC++ • C++ IS AN OBJECT ORIENTED PROGRAMMING LANGUAGE AND EXTENSION OF C. • BJARNE STROUSTRUP , MASTER OF SIMULA67 AND C COMBINED THE FEATURES OF BOTH AND DEVELOPED A POWERFUL LANGUAGE THAT SUPPORTS OBJECT ORIENTED PROGRAMMING WITH FEATURES OF C. • STROUSTRUP CALLED THE NEW LANGUAGE AS “ C WITH CLASSES “ . IN 1983 IT WAS NAMED AS C++. • C++ IS A SUPERSET OF C.
  • 3.
  • 4.
    1.3 THE ANSISTANDARD • ANSI – AMERICAN NATIONAL STANDARDS INSTITUTE. • INSTITUTE FOUNDED IN 1918 – GOAL OF THIS INSTITUTE WAS • TO SUGGEST • REFORM • RECOMMEND • AND PUBLISH STANDARDS FOR DATA PROCESSING IN USA. • RECOGNIZED COUNCIL MADE INTERNATIONAL STANDARD FOR C++ • C++ IS ALSO REFERRED AS ISO STANDARD. • FIRST DRAFT WAS MADE ON 25 JANUARY 1994. • ANSI STANDARD ATTEMPT TO ENSURE THAT C++ IS PORTABLE.
  • 5.
    1.7 PREFACE TOOBJECT ORIENTED PROGRAMMING • THE PROCEDURAL LANGUAGE DOES NOT ALLOW THE DATA TO FLOW FREELY AROUND THE SYSTEMS • TIES TO THE FUNCTIONS THAT OPERATE ON IT AND PREVENTS FROM ACCIDENTAL CHANGE • OOP PERMITS TO ANALYZE A PROBLEM INTO NUMBER OF ITEMS CALLED OBJECTS AND ASSEMBLES DATA AND FUNCTIONS.
  • 6.
    CHARACTERISTICS OF OOP •OOP PAYS MORE IMPORTANCE OF DATA RATHER THAN FUNCTION • PROGRAMS ARE DIVIDED INTO CLASSES AND THEIR MEMBER FUNCTION • OOP FOLLOWS BOTTOM UP APPROACH • NEW DATA ITEMS AND FUNCTIONS CAN BE ADDED WHENEVER NEEDED • DATA IS PRIVATE AND PREVENTED FROM ACCESSING EXTERNAL FUNCTIONS • OBJECTS COMMUNICATE WITH EACH OTHER THROUGH FUNCTIONS
  • 7.
    RELATION BETWEEN DATAAND MEMBER FUNCTIONS IN OOP OBJECT A OBJECT B OBJECT C Data variables Member function Data variables Member function Data variables Member function Data variables Member function Data variables Member function Data variables Member function
  • 8.
    1.8 KEY CONCEPTSOF OBJECT ORIENTED PROGRAMMING` OBJECT ORIENTED PARADIGM C++ Encapsulati on Data Abstraction Inheritance Polymorphi sm Delegation Genericity
  • 9.
    C++ CLASSES ANDOBJECTS • C++ IS AN OBJECT-ORIENTED PROGRAMMING LANGUAGE. • EVERYTHING IN C++ IS ASSOCIATED WITH CLASSES AND OBJECTS, ALONG WITH ITS ATTRIBUTES AND METHODS. FOR EXAMPLE. IN REAL LIFE, A CAR IS AN OBJECT. THE CAR HAS ATTRIBUTES, SUCH AS WEIGHT AND COLOR, AND METHODS, SUCH AS DRIVE AND BRAKE. • ATTRIBUTES AND METHODS ARE BASICALLY VARIABLES AND FUNCTIONS THAT BELONGS TO THE CLASS, THESE ARE OFTEN REFERRED TO AS "CLASS MEMBERS". • A CLASS IS A USER-DEFINED DATA TYPE THAT WE CAN USE IN OUR PROGRAM, AND IT WORKS AS AN OBJECT CONSTRUCTOR, OR A "BLUEPRINT" FOR CREATING OBJECTS.
  • 10.
    (1) OBJECTS • OBJECTSARE PRIMARY RUNTIME ENTITIES IN OBJECT ORIENTED PROGRAMMING • EG. A SPOT , A PERSON , ANY DATA ITEM RELATED TO PROGRAM INCLUDING USER-DEFINED DATA TYPES. • OBJECTS OCCUPY SPACE IN MEMORY • EVERY OBJECTS HAS ITS OWN PROPERTIES AND FEATURES • CAN BE RECOGNIZED BY ITS NAME
  • 11.
    OBJECTS • OBJECTS COMMUNICATEWITH EACH OTHER BY SENDING MESSAGES. • AN OBJECT CAN BE REPRESENTED BY • THE NAME OF THE ABOVE OBJECT IS CITY • ITS DATA MEMBERS ARE NAME_OF_CITY, POPULATION AND AREA • VARIOUS FUNCTIONS ASSOCIATED WITH CITY ARE AVERAGE AGE , LITERACY_RATE AND DISPLAY Object : City Data : Name_of_City Population Area Functions : Average age Literacy_rate Display
  • 12.
    (2) CLASSES • ACLASS IS A GROUPING OF OBJECTS THAT HAVE IDENTICAL PROPERTIES , COMMON BEHAVIOR AND SHARED RELATIONSHIP • A CLASS BINDS THE DATA AND ITS RELATED FUNCTIONS TOGETHER • CLASS IDENTIFIES THE NATURE AND METHODS THAT ACT ON THE DATA STRUCTURE AND ABSTRACT DATA TYPE • GROUP OF DATA AND CODE OF AN OBJECT CAN BE BUILT AS USER-DEFINED DATA TYPE BY USING CLASS. • OBJECTS ARE NOTHING BUT VARIABLES OF TYPE CLASS. • ONCE A CLASS IS CREATED , A NUMBER OF OBJECTS ASSOCIATED WITH THAT CLASS CAN BE CREATED • SYNTAX USED TO CREATE AN OBJECT IS SIMILAR TO CREATE AN INTEGER VARIABLE • CLASS DEFINES CHARACTERISTIC AND ACTION OF OBJECTS
  • 13.
  • 14.
  • 15.
    DATA TYPE ANDABSTRACT DATA TYPE • THE DATA TYPE IS BASICALLY A TYPE OF DATA THAT CAN BE USED IN DIFFERENT COMPUTER PROGRAM. IT SIGNIFIES THE TYPE LIKE INTEGER, FLOAT ETC, THE SPACE LIKE INTEGER WILL TAKE 4-BYTES, CHARACTER WILL TAKE 1-BYTE OF SPACE ETC. • THE ABSTRACT DATA TYPE IS SPECIAL KIND OF DATA TYPE, WHOSE BEHAVIOR IS DEFINED BY A SET OF VALUES AND SET OF OPERATIONS. THE KEYWORD “ABSTRACT” IS USED AS WE CAN USE THESE DATA TYPES, WE CAN PERFORM DIFFERENT OPERATIONS. BUT HOW THOSE OPERATIONS ARE WORKING THAT IS TOTALLY HIDDEN FROM THE USER. THE ADT IS MADE OF WITH PRIMITIVE DATA TYPES, BUT OPERATION LOGICS ARE HIDDEN. • SOME EXAMPLES OF ADT ARE STACK, QUEUE, LIST ETC. • LET US SEE SOME OPERATIONS OF THOSE MENTIONED ADT − • STACK − • ISFULL(), THIS IS USED TO CHECK WHETHER STACK IS FULL OR NOT • ISEMPTY(), THIS IS USED TO CHECK WHETHER STACK IS EMPTY OR NOT • PUSH(X), THIS IS USED TO PUSH X INTO THE STACK • POP(), THIS IS USED TO DELETE ONE ELEMENT FROM TOP OF THE STACK
  • 16.
    • QUEUE − •ISFULL(), THIS IS USED TO CHECK WHETHER QUEUE IS FULL OR NOT • ISEMPTY(), THIS IS USED TO CHECK WHETHER QUEUE IS EMPTY OR NOT • INSERT(X), THIS IS USED TO ADD X INTO THE QUEUE AT THE REAR END • DELETE(), THIS IS USED TO DELETE ONE ELEMENT FROM THE FRONT END OF THE QUEUE • SIZE(), THIS FUNCTION IS USED TO GET NUMBER OF ELEMENTS PRESENT INTO THE QUEUE • LIST − • SIZE(), THIS FUNCTION IS USED TO GET NUMBER OF ELEMENTS PRESENT INTO THE LIST • INSERT(X), THIS FUNCTION IS USED TO INSERT ONE ELEMENT INTO THE LIST • REMOVE(X), THIS FUNCTION IS USED TO REMOVE GIVEN ELEMENT FROM THE LIST • GET(I), THIS FUNCTION IS USED TO GET ELEMENT AT POSITION I • REPLACE(X, Y), THIS FUNCTION IS USED TO REPLACE X WITH Y VALUE
  • 17.
    (3) METHOD • ANOPERATION REQUIRED FOR AN OBJECT OR ENTITY WHEN CODED IN A CLASS IS CALLED A METHOD • OPERATIONS REQUIRED FOR AN OBJECT ARE TO BE DEFINED IN THE CLASS • ALL OBJECTS CARRY CERTAIN ACTIONS OR OPERATIONS • EACH ACTION NEEDS AN OBJECT THAT BECOMES A FUNCTION IN THE CLASS THAT DEFINES IT AND IS REFERRED AS A METHOD
  • 18.
    REPRESENTATION OF METHODSIN DIFFERENT MANNERS
  • 19.
    REPRESENTATION OF METHODSIN DIFFERENT MANNERS
  • 20.
    (4) DATA ABSTRACTION •ABSTRACTION REFERS TO THE PROCEDURE OF REPRESENTING ESSENTIAL FEATURES WITHOUT INCLUDING THE BACKGROUND DETAILS • CLASSES USE THEORY OF ABSTRACTION AND ARE DEFINED AS LIST OF ABSTRACT PROPERTIES SUCH AS SIZE , COST , HEIGHT , AND FEW FUNCTIONS TO OPERATE ON THESE PROPERTIES • DATA ABSTRACTION - PROCEDURE FOR IDENTIFYING PROPERTIES AND METHODS RELATED TO SPECIFIC ENTITY. • DATA ABSTRACTION USED TO DEFINE A DATA TYPE AVAILABLE IN PROGRAMMING LANGUAGE CALLED ABSTRACT DATA TYPE(ADT) – CONSISTS OF SET OF VALUES AND SET OF OPERATIONS.
  • 21.
  • 22.
    (5) ENCAPSULATION • THEPACKING OF DATA AND FUNCTIONS INTO A SINGLE COMPONENT • C++ SUPPORTS ENCAPSULATION USING CLASSES • DATA NOT REACHABLE BY OUTSIDE FUNCTION , ONLY THOSE FUNCTIONS THAT ARE ABLE TO ACCESS THE DATA ARE DEFINED WITHIN THE CLASS • THESE FUNCTIONS PREPARE INTERFACE BETWEEN OBJECTS DATA AND PROGRAM • WITH ENCAPSULATION DATA HIDING IS POSSIBLE • IMPORTANT FEATURE WHERE AN OBJECT CAN BE USED WITHOUT USER KNOWING HOW IT WORKS INTERNALLY.
  • 23.
  • 24.
    (6) INHERITANCE • INHERITANCEIS THE METHOD BY WHICH OBJECTS OF ONE CLASS GET THE PROPERTIES OF OBJECTS OF ANOTHER CLASS • IN OOPS INHERITANCE PROVIDES REUSABILITY • PROGRAMMER CAN ADD NEW PROPERTIES TO EXISTING CLASS WITHOUT CHANGING IT • THIS CAN BE ACHIEVED BY DERIVING A NEW CLASS FROM EXISTING CLASS • THE NEW CLASS WILL HAVE FEATURES OF BOTH THE CLASSES
  • 25.
  • 26.
    (7) POLYMORPHISM • ALLOWSTHE SAME FUNCTION TO ACT IN A DIFFERENT WAY IN DIFFERENT CLASSES • HOLDS THE ABILITY TO TAKE MORE THAN ONE FORM
  • 27.
  • 28.
    (8) DYNAMIC BINDING •BINDING MEANS CONNECTING ONE PROGRAM TO ANOTHER PROGRAM THAT IS TO BE EXECUTED IN REPLY TO THE CALL. • IS ALSO CALLED AS LATE BINDING • CODE PRESENT IN SPECIFIED PROGRAM IS UNKNOWN TILL IT IS EXECUTED.
  • 29.
  • 30.
  • 31.
    (10) REUSABILITY • ALLOWSREUSABILITY OF CLASSES BY EXTENDING THEM TO OTHER CLASSES USING INHERITANCE
  • 32.
    (11) DELEGATION • TWOCLASSES CAN BE JOINED IN 2 WAYS • INHERITANCE • DELEGATION  BOTH PROVIDE REUSABILITY OF CLASSES  IN INHERITANCE ONE CLASS CAN BE DERIVED FROM OTHER CLASS  RELATIONSHIP B/N 2 CLASSES- KIND OF RELATIONSHIP  IF CLASS Y IS DERIVED FROM CLASS X THEN CLASS Y IS KNOWN AS KIND OF X  WHEN OBJECT OF ONE CLASS IS USED AS DATA MEMBER IN THE OTHER CLASS – COMPOSITION OF OBJECTS – DELEGATION  EG. CLASS C HAS 2 DATA MEMBERS , THESE 2 DATA MEMBERS ARE OBJECTS OF CLASS A AND B –RELATIONSHIP BETWEEN THESE CLASSES IS - HAS A RELATIONSHIP
  • 33.
  • 34.
    (12) GENERICITY • S/WCOMPONENTS HAVE MORE THAN ONE VERSION DEPENDING ON DATA TYPES OF ARGUMENTS • THIS ALLOWS DECLARATION OF VARIABLES WITHOUT SPECIFYING EXACT DATA TYPE • COMPILER IDENTIFIES DATA TYPE AT RUNTIME
  • 35.
    1.9 ADVANTAGES OFOOP • CAN BE COMFORTABLY UPGRADED • USING INHERITANCE , ELIMINATE REDUNDANT PROGRAM CODE AND CONTINUE THE USE OF PREVIOUSLY DEFINED CLASSES • DATA HIDING ENABLES PROGRAMMER TO DESIGN AND DEVELOP SAFE PROGRAMS THAT DOES NOT DISTURB CODE IN OTHER PARTS OF PROGRAM • ENCAPSULATION ALLOWS TO DEFINE THE CLASS WITH MANY FUNCTIONS AND CHARACTERISTICS BUT ONLY FEW FUNCTIONS ARE EXPOSED TO USER • ALLOWS TO CREATE EXTENDED AND REUSABLE PARTS • OBJECTS COMMUNICATE WITH EACH OTHER AND PASS MESSAGES • 1.10 OBJECT ORIENTED LANGUAGES SEE THE TABLE IN THE BOOK