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 is the real name of JavaScript?
Which built-in method returns the string representation of the number’s value?
How to convert a string to a number using javascript?
What does three dots mean in texting?
What is arguments object in JavaScript?
What are the different types of errors supported by javascript?
What is lazy loading in javascript?
Where do you put javascript in html?
What is the purpose of using javascript?
How can a Javascript code redirect the user to a different page?
What is the function of delete operator?
How to make a function in javascript?
What is use of JavaScript and jquery?
Is javascript a programming language?
What is eval() in javascript?