Skip to content

Overview

In Part 2, Chapter 2 we learned how to organise the instructions in our code into named groups called functions and procedures. Then, in Part 2, Chapter 3 we learned how we can use custom data types to organise the data in our programs. These two ideas were combined in Part 2, Chapter 7 where we explored adding member functions to our structs.

Classes combine functions, procedures, and data into a single entity in the same way as we saw in Part 2. They are a powerful tool, and open up new and exciting capabilities for building digital realities.

In this chapter we will explore the power of classes, to move beyond organising our code, and to start modelling our concepts within our programs.

Learning goals

By the end of this chapter you should be able to:

  • Describe what a class is, and how classes relate to objects.
  • Read UML class diagrams and implement the class structures they describe.
  • Write basic UML class diagrams to communicate your own class structures.
  • Explain and visualise what the computer does during the runtime of simple programs using classes.