Difference between revisions of "Object-oriented programming"

From CS 61A Wiki
Jump to: navigation, search
[checked revision][checked revision]
(add sources)
(Sources: 1 more)
Line 27: Line 27:
 
* http://inst.eecs.berkeley.edu/~cs61a/fa13/slides/15-Objects_6pp.pdf
 
* http://inst.eecs.berkeley.edu/~cs61a/fa13/slides/15-Objects_6pp.pdf
 
* http://inst.eecs.berkeley.edu/~cs61a/sp14/disc/discussion06.pdf
 
* http://inst.eecs.berkeley.edu/~cs61a/sp14/disc/discussion06.pdf
 +
* http://www-inst.eecs.berkeley.edu/~cs61a/sp14/slides/15_6pp.pdf

Revision as of 15:43, 6 July 2014

Object-oriented programming (OOP) is a method for bundling together information and related behavior.

Motivation

  • data abstraction/ADT

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