A class constructor is a special method that creates an instance of a class. The constructor returns an instance of the class.

A class can have more than one constructor, each with a different parameter list. This is useful when you need to create instances in different ways for different parts of the application. For example, you could have one Customer constructor that takes no input parameters that is called by one part of the application. In this case an “empty” Customer instance is created and another part of the application initializes the data members of the Customer instance. You can also have a constructor that takes values for the Customer when it is created. When the constructor executes, it will populate the data members for this instance with these values.

Note: A best practice is to define the constructor as PUBLIC so that other parts of the application can create instances of the class.

For more information, see Comparison with procedure-based programming main blocks of persistent procedures