Unity Learn home
View Tutorial Content

Encapsulation in object-oriented programming

Tutorial
Foundational
+10 XP
20 Mins
(1473)
Overview
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
  • Obj-Prog-WIC-3.3: 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: January 03, 2024
2022.3
2022.2
2022.1
2021.3
2020.3
Language
English
Encapsulation in object-oriented programming