KEMBAR78
Object Oriented Programming - Cheat sheet.pptx
OBJECT ORIENTED
PROGRAMMING
MOSIUOA WESI
ANDHRA UNIVERSITY
OOP
• It refers to language that uses object in programming. OOP iams to
implement real world entities like inheritance, hiding, polymorphism
in programming.
• OOP aims to bind together data and functions that operate on them
so that no other part of code can access this data except function.
OOP Concepts
• Class
• Objects
• Data Abstraction
• Inheritence
• Polymorphimsm
• Dynamic Binding
• Message Passing
1. Class
• It is a user-defined data type and
consists of members abd
member fucntions which can be
accessed and used by creating
an instance of that class
• It represents the set of
properties or methods thatare
common to all objects of one
type.
• Example
Class
car
Properties
• Wheels
• Speed limits
• Millage
• Brand
• model
2. Object
It is the basic unit of Object Oriented Programming and represent real
life entities. It is an instance of the class.
• When a class is defined, no memory is allocated but when it is
instantiated, memory is allocated.
• An object has an IDENTITY, STATE and BEHAVOUR.
• Each object contains data and coed to manipulate the data
• An object can interact withoiut having to know details of each others
data or code, it is the sufficient to know types of message accepted
and type of response returned by the objects.
Object cont...
Identity
Name of the Dog
State/Attributes
• Breed
• Age
• Color
Behaviour
• Bark
• Sleep
• Eat
3. Data Abstraction
• It refers to providing only essential information about the data to the
outside world, hiding the background details and implementation.
3. Data Abstraction
• It refers to providing only
essential information about the
data to the outside world, hiding
the background details and
implementation.
• Example
A man driving a car only knows
that pressing the accelarator will
increase the speed of the car or
applying brake will stop the car,
but doesnot know about the inner
mechanism behind.
4. Encanpusation
• It is the wrapping up of the data
under single unit.
• It is the mechanis, that binds
together code and the data it
manipulates.
• In encapsulation, the variables or
data of thr class are hidden from
any class and can be accessed only
through any member fucntion of
their class in which they are
declared.
• As in encapsulation, the data in a
class is hidden from other class
so it is also know as data hiding.
Encapsulation
class
VavaVariables
Data
5. Inheritence
The capabilities of a class to derive properties and charastersits from
another class is called Inheritance.
• When we write a class, we inherit properties from other class, so whn
we create a class, we do not need all properities and functions again
and again as this can be inherited from another class that passes it.
• Inheritence allows the user to reuse the code whenever possible and
reduce its redundency.
Types of Inheritence
• Single Inheritence
• Multi-Level Inheritence
• Multiple Inheritence
• Hierachical Inheritance
• Hybrid
Parent Child
Parent Derived 1 Derived 2
Parent Parent
Child
Parent
Child 1 Child 2 Child 3
Derived 1
Parent
Derived 2
Derived 3
6. Polymorphism
The word polymorphm means
may forms.
In simple words, we can define
polymorphism as the ability of a
message to be displayed in more
than one form.
Example
• A person at same time can have
different charasteristics. Like a
man at same time can be a
father, husband and an
employee.
• So the same person posses
different behaviour in different
situations.
Types of Polymorphism
Types broken down
Types
Compile
Time
Function
Overloading
Operators
Overloading
Runtime
Virtual Functions
7. Dynamic Binding
• Code to be executd in response to the function call is decided at
runtime
• It means that the code associated with a given procedure call is not
known until the the time of the call at runtime.
• Dynamic Method Binding One of the advantages of inheritendce is
that some derived class all the members of its base class B.
• Once D is not hiding any of the public members of B, then an object of
D can represent B, in any context where a B could be used.
• This feature is known as subtypes polymorphism.
8. Message Passing
• It is a form of communication used in object oriented programming as
well as parellel programming.
• Objects communicate with one another by sending and recieving
information to each other.
• A message for an object is a request for execution of a procudere and
therefore will invoke a function in recieving object that generates the
derived results.
• Messages passing involves specifying the name of the object, the
name of the fucntion and the information to be sent.

Object Oriented Programming - Cheat sheet.pptx

  • 1.
  • 2.
    OOP • It refersto language that uses object in programming. OOP iams to implement real world entities like inheritance, hiding, polymorphism in programming. • OOP aims to bind together data and functions that operate on them so that no other part of code can access this data except function.
  • 3.
    OOP Concepts • Class •Objects • Data Abstraction • Inheritence • Polymorphimsm • Dynamic Binding • Message Passing
  • 4.
    1. Class • Itis a user-defined data type and consists of members abd member fucntions which can be accessed and used by creating an instance of that class • It represents the set of properties or methods thatare common to all objects of one type. • Example Class car Properties • Wheels • Speed limits • Millage • Brand • model
  • 5.
    2. Object It isthe basic unit of Object Oriented Programming and represent real life entities. It is an instance of the class. • When a class is defined, no memory is allocated but when it is instantiated, memory is allocated. • An object has an IDENTITY, STATE and BEHAVOUR. • Each object contains data and coed to manipulate the data • An object can interact withoiut having to know details of each others data or code, it is the sufficient to know types of message accepted and type of response returned by the objects.
  • 6.
    Object cont... Identity Name ofthe Dog State/Attributes • Breed • Age • Color Behaviour • Bark • Sleep • Eat
  • 7.
    3. Data Abstraction •It refers to providing only essential information about the data to the outside world, hiding the background details and implementation.
  • 8.
    3. Data Abstraction •It refers to providing only essential information about the data to the outside world, hiding the background details and implementation. • Example A man driving a car only knows that pressing the accelarator will increase the speed of the car or applying brake will stop the car, but doesnot know about the inner mechanism behind.
  • 9.
    4. Encanpusation • Itis the wrapping up of the data under single unit. • It is the mechanis, that binds together code and the data it manipulates. • In encapsulation, the variables or data of thr class are hidden from any class and can be accessed only through any member fucntion of their class in which they are declared. • As in encapsulation, the data in a class is hidden from other class so it is also know as data hiding. Encapsulation class VavaVariables Data
  • 10.
    5. Inheritence The capabilitiesof a class to derive properties and charastersits from another class is called Inheritance. • When we write a class, we inherit properties from other class, so whn we create a class, we do not need all properities and functions again and again as this can be inherited from another class that passes it. • Inheritence allows the user to reuse the code whenever possible and reduce its redundency.
  • 11.
    Types of Inheritence •Single Inheritence • Multi-Level Inheritence • Multiple Inheritence • Hierachical Inheritance • Hybrid Parent Child Parent Derived 1 Derived 2 Parent Parent Child Parent Child 1 Child 2 Child 3 Derived 1 Parent Derived 2 Derived 3
  • 12.
    6. Polymorphism The wordpolymorphm means may forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form. Example • A person at same time can have different charasteristics. Like a man at same time can be a father, husband and an employee. • So the same person posses different behaviour in different situations.
  • 13.
    Types of Polymorphism Typesbroken down Types Compile Time Function Overloading Operators Overloading Runtime Virtual Functions
  • 14.
    7. Dynamic Binding •Code to be executd in response to the function call is decided at runtime • It means that the code associated with a given procedure call is not known until the the time of the call at runtime. • Dynamic Method Binding One of the advantages of inheritendce is that some derived class all the members of its base class B. • Once D is not hiding any of the public members of B, then an object of D can represent B, in any context where a B could be used. • This feature is known as subtypes polymorphism.
  • 15.
    8. Message Passing •It is a form of communication used in object oriented programming as well as parellel programming. • Objects communicate with one another by sending and recieving information to each other. • A message for an object is a request for execution of a procudere and therefore will invoke a function in recieving object that generates the derived results. • Messages passing involves specifying the name of the object, the name of the fucntion and the information to be sent.