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
Difference between undefined and undeclared variables?
What is innertext javascript?
How to disable an html object ?
how do you declare variables in javascript?
How is it possible to get the total number of arguments that are passed to a function?
What is the difference between window and document in Javascript?
Consider the following code: 1 2 3 4 5 (function() { var a = b = 5; })(); console.log(b); what will be printed on the console?
What is argument objects in javascript?
What are the ways of making comments in javascript?
What is the use of javascript?
How would you compare two objects in JavaScript?
How to toggle display an html element?
Is everything in javascript asynchronous?
What is difference between local and global scope in javascript ?
What's the difference methods get and post in html forms?