Constructors
Take a deeper look at class constructors in this lesson.
Constructors are a special type of methods that are used to instantiate objects of a class. As we saw in the last couple of lessons, a class gives the blueprint of a non-primitive data type. To create objects from this class, we need constructors.
The code for a simple Introduction
class is reproduced below. Let’s take a look at the anatomy of the constructor below.
Get hands-on with 1400+ tech skills courses.