Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is constructor in a class, how it is work, how it is call?

Answer Posted / kapil dhiman

Constructor is a special function which is automaticaly called when object of the class is created.In php4 costructor having the same name of the class while in php5 costructor function declare like __construct(){ }.
<?
class MakeConstruct{

public function __construct(){

echo "php5 construct";

}


public function MakeConstruct(){

echo "php4 construct";

}

}

$obj= new MakeConstruct();

?>

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the advantage of runtime polymorphism?

899


What is an anti csrf token?

883


What is Apache's configuration file typically called?

1065


What are the method available in form submitting?

946


What is difference between base_url and site_url?

963


Tell me how comparison of objects is done in php5?

890


What are the different types of statements that are present in php?

965


How to call php function in jquery?

1030


What is a namespace in php?

914


What are the rules to determine the “truth” of any value which is not already of the boolean type?

913


What is a php trait?

896


What is $_ files in php?

1048


What is the purpose of php?

930


What is php limit?

988


Which is the best web server?

940