Answer Posted / lakshmanan
Using extends keyword you can extend Superclass.
Lets go for an example,
Class Pay{
var $Amt=10;
var $M="";
Function CheckAmt($Amt){
$this->Amt=$Amt;
}
}
Class Salary extends Pay{
Function CheckAmt($Amt){
$this->Amt=$Amt;
If ($this->Amt > 1000){
echo "Good Salary";
} else {
echo "Okay Salary";
}
}
}
$CheckP = new Pay;
echo $CheckP->Amt;
echo "<br>";
$CheckP->CheckAmt(1000);
echo $CheckP->Amt;
echo "<br>";
$CheckS = new Salary;
echo $CheckS->CheckAmt(100000);
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What does the operator do in javascript?
What are the primitive data types in JavaScript?
Can you give an example showing javascript hoisting?
What is the use of a typedarray object in javascript?
How to make a array as a stack using javascript?
List out all the falsifying tokens in Javascript?
What is the default scope in javascript?
How do I turn off javascript in chrome?
What is the scope of variables in JavaScript?
How do you trim in javascript?
Is jquery easier than javascript?
Which is faster jquery or javascript?
Do unused imports affect performance javascript?
What are the seven data types of javascript?
Why would you use a sticky session?