What are constructors and deconstructors in c programming language?

Answer:

Constructors are functions that you use to define (initialize) the properties and methods of a class. By definition, constructors are functions within a class definition that have the same name as the class. For example, the following code defines a Circle class and implements a constructor function:

// file Circle.as class Circle { private var circumference:Number; // constructor function Circle(radius:Number){ this.circumference = 2 * Math.PI * radius; } }

The term constructor is also used when you create (instantiate) an object based on a particular class. The following statements are calls to the constructor functions for the built-in Array class and the custom Circle class:

var my_array:Array = new Array(); var my_circle:Circle = new Circle(9);

First answer by ID1975756141. Last edit by ID1975756141. Question popularity: 2 [recommend question].