What is constructer and deconstruct ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is constructer and deconstruct ?

Php

12th Jan 2021, 7:16 AM
Bhavik Modi
Bhavik Modi - avatar
2 Answers
+ 6
Remember one thing that C language does not have OOP concept so it's not possible in C. For using this concept you can use C++, java, python, php etc languages Constructor is the function which is called automatically when ever the object is created. Constructor will have the same name as that of class name and is usually used to initialize the variables. Destructors are called explicitly when ever the program is going to end.This is used to delete the variables. Destructors also have the same name as of class name but preceded with tilde symbol(~) And remember to declare both constructor or destructor In public access specifier otherwise it won't work if it is mentioned in private access specifier
12th Jan 2021, 11:04 AM
Aysha
Aysha - avatar
+ 3
You just got started, just continue with PHP tutorial for now, you'll get to know it when you get to OOP module 👍
12th Jan 2021, 9:07 AM
Ipang