Home | | Computer Science 11th std | Destructors

Computer Science - Destructors | 11th Computer Science : Chapter 14 : Classes and objects

Chapter: 11th Computer Science : Chapter 14 : Classes and objects

Destructors

When a class object goes out of scope, a special function called the destructor gets executed.

Destructors

 

When a class object goes out of scope, a special function called the destructor gets executed. The destructor has the same name as the class tag but prefixed with a ~(tilde). Destructor function also return nothing and it does not associated with anydata type.

 

Need of Destructors

 

The purpose of the destructor is to free the resources that the object may have acquired during its lifetime. A destructor function removes the memory of an object which was allocated by the constructor at the time of creating a object.


Tags : Computer Science , 11th Computer Science : Chapter 14 : Classes and objects
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 14 : Classes and objects : Destructors | Computer Science

Related Topics

11th Computer Science : Chapter 14 : Classes and objects


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.