Unity Learn home
View Tutorial Content

Encapsulation in object-oriented programming

Tutorial
Foundational
+10 XP
20 Mins
(1923)
Overview
For Educators
Summary
In this tutorial, you’ll learn about the second pillar in object-oriented programming: encapsulation.
  • Explain how encapsulation is used to write code that can only be used as intended by the programmer
  • Control access to data within a class by applying encapsulation with getters and setters
  • Differentiate between public variables (properties), private variables (fields), and local variables.
  • Enable easier readability and debugging by correctly organizing classes to include only singular purpose code
Select your Unity version
Last updated: September 20, 2022
2022.3
2022.2
2022.1
2021.3
2020.3
Language
English
Encapsulation in object-oriented programming