Introduction
The basic building blocks of object-oriented programming are custom types you define to model the data your app uses. Traditional types like String and Int are limited in what they can represent and don’t fit to model complex data types. You can think of custom types as templates that you can create to represent different kinds of data in your app. For instance, you might have a “Person” type with properties such as name, age, and address. This “Person” type is your custom type, and it models the data related to a person. Kotlin provides us with classes that we use to define custom types.
In this lesson, you’ll -
- Define a
MuseumObjecttype with properties and a method. - Instantiate objects and learn how to use them.
- Look at hiding one of the
MuseumObject’s properties by making itprivate.
Then you will be able to:
- Identify classes and objects in Kotlin programming language
- Describe the concept of encapsulation and data hiding