what is constructor in a class, how it is work, how it is call?
Answers were Sorted based on User's Feedback
Answer / sei thu htun
Constructors are functions in a class that are automatically
called when you create a new instance of a class with new. A
function becomes a constructor, when it has the same name as
the class. If a class has no constructor, the constructor of
the base class is being called, if it exists.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / 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 |
Explain the difference between array_merge() and array_combine()?
How to implement a class named dragonball. This class must have an attribute named ballcount (which starts from 0) and a method ifoundaball. When ifoundaball is called, ballcount is increased by one. If the value of ballcount is equal to seven, then the message you can ask your wish is printed, and ballcount is reset to 0. How would you implement this class?
what use of <?php
What is difference between get and post?
if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer
What is php explain?
What are the limitations or drawbacks of PHP ?
What are the advantages of php mysql?
Difference between get and post method.
How to submit form without a submit button.
How to convert strings in hex format?
Hi, My Name is Ajay Jha. What My Question is I am Percuing in Bca. It's My 5th Semester. I Want To Make My Carrear as a web designer that's Why i wants to do Php, Is it right Desision for Me ?