Creating several objects from one class
Creates a second object from the same class. Each object keeps its own attribute values, so changing s2 does not change s1, but both use the same methods.
Understanding Creating several objects from one class in ACARA Digital Technologies Years 9–10
What it does: Both objects come from Student, but each is given a different name, so each stores different data. You make objects by calling the class name with brackets. Writing class again would define a new class, not create an object. Each object stores its own attribute values. Changing s2 does not touch s1. add_points() changed self.score for p1 only. p2 has its own score attribute, which is still 0. Student('Liam') builds a new object. s2 = s1 only gives the same object a second variable name, so no new object is made. self is the object the method was called on. That is why s1.greet() and s2.greet() can print different names.
Common mistakes: == compares values, so no attribute is stored. It should be self.name = name so every Student object keeps its own name. The string is missing its closing quote. It should be print('Woof!'). Both Dog objects share this same bark method.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 629–680) and word search (Modules 629–707).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
s2 = Student('Liam')Fill in the Blanks
Spot the Error
Student with a class code? Join your class →