Question:What are constructor and destructor? 

Answer Constructor: A constructor is defined as a block of code that automatically executes at the time of object instantiation. Constructors can accept parameters, call class methods or  other functions.PHP recognizes constructor by the  name__construct.  The general  Syntax→
        function__construct([argument1,argument2,….,argumentN]){
            //Class initialization code  
        }
Destructor:
 We can use destructors to modify the object destruction process.Derstructors are  created like any other method but must be titled    __destruct().   Syntax→    
function__destruct(). 


Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in D:\webserver\www\vcampusbd.com\answers\column_answer_two.php on line 128
+ Report
Total Preview: 1379
What are constructor and destructor?
Copyright © 2024. Powered by Intellect Software Ltd