Lesson details

Key learning points

  1. In this lesson, we will learn about a key principle of object-oriented programming - Inheritance. We will use it to create new monster classes for the Monster Quest puzzle game. These new classes will inherit all the attributes and methods of the original monster class and add some new ones all their own!

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...

4 Questions

Q1.
In this piece of code, zombie is a...
Attribute
Class
Method
Correct answer: Object
Q2.
When you create a new object from a class you need to use a...
Attribute
Correct answer: Constructor
Getter
Method
Q3.
To access the name of the Monster in this code which line in correct?
Correct answer: print(zombie.getName())
print(zombie.name)
Q4.
An object is a structure that contains...
A whole program
Data
Correct answer: Data and methods
Methods

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():

Lesson appears in

UnitComputing / Object-oriented programming

Computing