Classes & objects

HSC Software Engineering · Unit 3: Object-oriented programming

Classes & objects notes

Fact-checked by a second, independent AI review.

Key ideas: a class is a blueprint for objects; objects are instances with their own data and behaviours via attributes and methods. Understand constructors, encapsulation, and how objects are created and interacted with.

Class
Blueprint for objects; defines properties (attributes) and behaviours (methods) that objects of this type have.
Object
An instance of a class with its own attribute values; created from the class blueprint.
Attribute/Property
Data stored in an object that represents its state (e.g., name, age).
Method
Behaviour or function that objects of the class can perform; actions defined in the class.
Constructor
Special method used to create and initialise a new object of a class.
Encapsulation
Hiding internal object state and restricting access, exposing only through methods.

Remember it: COAM: Class, Object, Attributes, Methods — think of a coat: the class is the coat, the object is wearing it, attributes are pockets, methods are the actions you can perform.

Exam tip: Markers want clear definitions of class vs object, correct use of attributes and methods, understanding of constructors, and examples or mini‑diagrams showing instantiation and encapsulation. Be able to explain with short examples and identify these elements in simple UML class diagrams.

Syllabus checklist

  • Classes & objects: core ideas
  • Terms and typical exam questions for "Object-oriented programming" in NSW HSC Software Engineering

Practice questions

  1. 1. What describes the blueprint used to create objects in OOP?

    Answer checked

    Show answer

    Answer: Class. A class defines the structure and behaviour that its objects will have.

  2. 2. Which statement about encapsulation is true?

    Answer checked

    Show answer

    Answer: Data and methods are hidden from outside code. Encapsulation hides internal state and requires interaction through public methods.

  3. 3. A constructor is a special method that runs when a new object is created.

    Answer checked

    Show answer

    Answer: True. Constructors initialize a new object upon instantiation.

  4. 4. To create an object, you first declare a ____ and then instantiate it.

    Answer checked

    Show answer

    Answer: class. The keyword class defines the blueprint before creating an instance.

  5. 5. In many OO languages, the keyword used to define a class is ____.

    Answer checked

    Show answer

    Answer: class. The standard keyword for defining a class in many OOP languages is class.

Practise classes & objects as a game

Hearts, combos, streaks and an AI tutor that explains every answer. Start free.

Start free

More from Unit 3: Object-oriented programming