Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is inheritence

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


Please Help Members By Posting Answers For Below Questions

What does the operator do in javascript?

949


What are the primitive data types in JavaScript?

1085


Can you give an example showing javascript hoisting?

916


What is the use of a typedarray object in javascript?

1012


How to make a array as a stack using javascript?

1075


List out all the falsifying tokens in Javascript?

1161


What is the default scope in javascript?

923


How do I turn off javascript in chrome?

1005


What is the scope of variables in JavaScript?

1097


How do you trim in javascript?

999


Is jquery easier than javascript?

950


Which is faster jquery or javascript?

995


Do unused imports affect performance javascript?

1583


What are the seven data types of javascript?

1102


Why would you use a sticky session?

1017