notes46 - CS 61A Lecture Notes Week 7 Topic:...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 61A Lecture Notes Week 7 Topic: Object-oriented programming Reading: OOP Above-the-line notes in course reader Midterm 2 is this week. OOP is an abstraction. Above the line we have the metaphor of multiple independent intelligent agents; instead of one computer carrying out one program we have hordes of objects each of which can carry out computations. To make this work there are three key ideas within this metaphor: Message passing: An object can ask other objects to do things for it. Local state: An object can remember stuF about its own past history. Inheritance: One object type can be just like another except for a few diFerences. We have invented an OOP language as an extension to Scheme. Basically you are still writing Scheme programs, but with the vocabulary extended to use some of the usual OOP buzzwords. ±or example, a class is a type of object; an instance is a particular object. “Complex number” is a class; 3 + 4 i is an instance. Here’s how the message-passing complex numbers from last week would look in OOP notation:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online