Kotlin, much like Java, is an object-oriented programming language. The term, “object-oriented” refers to a language that is made up of objects and can utilize various methodologies such as encapsulation, polymorphism, and inheritance. In this lesson, we’ll make a brief introduction into the world of objects with a tool known as classes.
Classes allow us to create blueprints of everyday objects and then utilize this blueprint to create as many unique instances of it as we’d like. Assume we’re building a program for a car dealership. We’d need to store some of the following basic characteristics for each car:
We can use a class to create a blueprint with all of these properties from which we would then create each individual car. Each unique car would be an instance of this class, also known as an object.
With each new concept we’ve learned about in this course, we’ve made our programs more dynamic and customizable, and classes will be no different. With classes, we have the ability to mimic real-world world objects in our code and tailor them to our liking.
In this lesson, we’ll focus on creating classes, generating individual objects from them, and exploring their available functionalities.
Take a look at the image to the right.
With all of your help and hard work thus far, Codey’s finally en route to DevCity! DevCity utilizes blueprints (classes) to generate each one of its skyscrapers. Notice how although each blueprint is the same, the final result, or object, is different.
Click Up Next to move on and help Codey understand and master the concept of classes as they journey through the city.