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
How will you create new object in javascript?
Should I learn java first or javascript?
How to capture the Image width and height using QTP script ? Kindly answer plz.... Thanx in adavance...
Which built-in method sorts the elements of an array?
What is difference between local and global scope in javascript ?
Should I disable javascript?
Which software is best for javascript?
How can you create an Array in JavaScript?
How to add new elements dynamically?
Where do I put javascript in html?
What is the difference between JavaScript and jscript?
Explain how can you submit a form using JavaScript?
How to change style on an element?
What is the === in javascript?
What is the difference between sessionstate and viewstate?