New course! Every coder should learn Generative AI!
Try a free lesson0
What is constructer and deconstruct ?
Php
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
+ 3
You just got started, just continue with PHP tutorial for now, you'll get to know it when you get to OOP module 👍