DP Computer Science · HL / SL · B3 Object-oriented programming

B3.1 Fundamentals of OOP for a single class

Get started
Notes Quiz

What is a Class?

In Object-Oriented Programming (OOP), everything revolves around the idea of classes and objects. A class is the starting point , it acts as a template that defines what data and behaviours all objects of that type will share.

Class: A class is a blueprint or template that defines the attributes (data) and methods (behaviours) that objects created from it will have. No memory is allocated for data when a class is defined , it is purely a description.

Every class has two main components:

  • Instance variables (attributes/fields) , represent the state of an object (e.g., a bird's species and age)
  • Methods , represent the behaviours or actions an object can perform (e.g., a bird singing)
Analogy

Think of a class like an architect's blueprint for a house. The blueprint describes the number of rooms, the layout, and the materials , but no actual house exists yet. You need to build a house from the blueprint before anyone can live in it.

Note

In Java, the filename must match the class name exactly (e.g., Bird.java for class Bird). In Python, this is good practice but not enforced by the language.

Free preview

9 more sections in this topic

Next topic →B3.2 Fundamentals of OOP for multiple classes (HL only)
Koncepts

Learn it properly. Then practise like it's the real paper.

Start free

Features

  • Lessons
  • Past papers
  • Library
  • Homework Help
  • Duels

More

  • For parents
  • Compare
  • Plans & pricing
  • DP for students

Legal

  • Privacy
  • Terms
  • Account deletion

© 2026 Koncepts (product of PrepAiro, Inc). All rights reserved.
DP, IB, EE and TOK are terms of the International Baccalaureate Organization.

Made for IB DP students.