Ask your Question

Discover our new Professionals

rakesh
rakesh

Software Developer

Delhi,  India
Prashant
Prashant

Web Developer

Noida,  India
shubham
shubham

php developer

noida,  India
Divyanshu
Divyanshu

Having experience in android development

Noida,  India
Parul
Parul

I am a java developer, having 2 year of experience in Java

Delhi,  India

Write to us

Ask Question

Difference between constructor and destructor?

Diksha Jain

Constructor is a special function which is automatically called when an object is created.

Constructor is used to initialise the class member.

In php constructor is a function __CONSTRUCT.

Destructor is a special function which is automatically call when an object goes out of the scope. 

In php destructor is created with a name __DESTRUCT.

Destructor is used to write the cleanup code that release all the resources associated with your object.

Diksha Jain

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site