These resources were made for remote use during the pandemic, not classroom teaching.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. In this lesson, we will explore a program written using OOP. We will use our experience to first investigate and then modify the program. Finally, we will add a new subclass to the program and apply the principle of inheritance.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

Prior knowledge starter quiz

Download quiz pdf
Share with pupils

4 Questions

Q1.
When using inheritance in your object-oriented programs, you can create a new class that inherits from a class that already exists. What is the original class called?

Instance
Object
Subclass
Correct answer: Superclass

Q2.
When you create a new class with Inheritance - what is the class that is created called?

Constructor
Instance
Correct answer: Subclass
Superclass

Q3.
When you use inheritance what does the new class inherit?

Correct answer: Attributes and methods
Just Attributes
Just Methods
Nothing

Q4.
Which of these class declarations is using inheritance?

Correct answer: class Bike(Vehicle):
class NewVehicle():
class Vehicle():

5 Questions

Q1.
Which of the following are examples of classes used in the example program? (Tick 2 boxes)

book.py
hunger_games
jane
Correct answer: Library
Correct answer: User

Q2.
Which of the following are examples of objects used in the example program? (Tick 2 boxes)

book.py
Correct answer: hunger_games
Correct answer: jane
Library
User

Q3.
Which of the following is a method in the Book class?

author
Correct answer: rent_out
self
title

Q4.
Which of the following is an example of an attribute in the Library class?

__init__
add_user
Correct answer: books
list_books_author

Q5.
To create a new object of the Book class which of the following lines of code would you use?

book_object = Book.__init__(self)
Correct answer: book_object = Book()
book_object = new Book
Book()