Skip to main content

Constructor and Destructor

Body

Constructor and Destructor

In this part you will learn: 1. What are Constructor and Destructor? 2. Types of Constructor 3. Syntax of Constructor and Destructor 4. Writing program with constructor and destructor 5. Showing output Constructor Constructor is a function of the class which is called at initialization or declaration of an object. To initialize values to the members of the function we use this function. For example if we have a class named “fraction” having num and denom as discussed earlier and we want to initialize every fraction created a

Add new comment