Chapter 7 Object Oriented Programming

Class: code that specifies the data attributes and methods of a particular type of object

Instance: object created from class

Class diagram

  • ‘-’ is private, ‘+’ is public

Benefits of OOP

  • Reusability
  • Extensibility

Encapsulation: combine data and procedure into a single object

data hiding: object’s data attributes are hidden from code outside the object and access is restricted to object’s methods

polymorphism: object’s ability to take different forms