Object-oriented programming

From CS 61A Wiki
Revision as of 00:12, 17 July 2014 by Dickson.tsai (Talk | contribs)


Jump to: navigation, search

Object-oriented programming (OOP) is a method of programming using objects that store/organize their own data and interact with each other via their methods. Programming languages that support object-oriented programming provide a built-in way to implement data abstractions, as classes correspond to abstract data types (ADTs).

Motivation

Terminology

Syntax

  • dot notation
  • bound method vs function
  • self
  • __init__
  • attribute access/assignment
    • for methods
      • for the class: A.method = lambda self: "test"
      • for an instance: inst.method = lambda: "test"

Inheritance

Main article: Inheritance

Sources