Level 2

Functions in Classes

views

8:32
This function is called by the compiler by default when we create an object of the class. The purpose of this function is to initialize the variables in the class. This function does not have a return value. The name of this function is the same as the name of the class. If we have not written a constructor, the compiler will not throw an error.