Unit 2

OOP and Inheritance

« Previous | Next »

Session Overview

In this lecture, we learn about object-oriented programming (OOP) and how classes are used to implement new types of objects in Python. As part of that discussion we introduce inheritance.

Image courtesy of The Ridg on Flickr.

Session Activities

Lecture Videos

About this Video

Topics covered: Object-oriented programming (OOP), abstract data types, specifications, subclasses, inheritance.


Recitation Videos

About this Video

Topics covered: Double recursion, big O notation, binary function, run times, object-oriented programming, classes, encapsulation, methods, class hierarchy, subclasses, inheritance, polymorphism, accessor and mutator functions, Person example, underbar methods, self parameter.

Check Yourself

What is an instance?

View/hide answer

Instances are the actual objects built in accordance with the qualities of the class.

What is an abstract data type?

View/hide answer

A set of objects and the operations on those objects.

What is encapsulation?

View/hide answer

Encapsulation means that names (of variables and methods) are stored in locations that then have to be accessed, called namespaces.

What is data hiding?

View/hide answer

Data hiding makes data invisible to users of the object, requiring it to be accessed only via the object’s methods.

What functions can subclasses use?

View/hide answer

Subclasses can use all the functions of their superclass. They can also use any functions that are defined within the subclass; however, if the subclass uses the same name for a function which has also been used in the superclass, it will only use the subclass definition of that function.

« Previous | Next »

Course Info

Learning Resource Types

theaters Lecture Videos
theaters Recitation Videos
assignment_turned_in Problem Sets with Solutions
grading Exams with Solutions
menu_book Online Textbook
assignment_turned_in Programming Assignments with Examples