हिंदी

Need of using a Constructor

Topics

Advertisements
CISCE: Class 10

Need of using a Constructor:

When you create various objects of a class, data members are automatically allocated. But in practice, you may like to have different initial values for instance, for the variable of each object. Thus, a constructor is an instance method used to initialize the object of a class that can automatically be called while creating an object. 

Advertisements
Share
Notifications



      Forgot password?
Use app×