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 is the real name of JavaScript?

1152


Which built-in method returns the string representation of the number’s value?

1183


How to convert a string to a number using javascript?

1117


What does three dots mean in texting?

987


What is arguments object in JavaScript?

1201


What are the different types of errors supported by javascript?

1192


What is lazy loading in javascript?

1123


Where do you put javascript in html?

1102


What is the purpose of using javascript?

996


How can a Javascript code redirect the user to a different page?

1001


What is the function of delete operator?

1022


How to make a function in javascript?

976


What is use of JavaScript and jquery?

1166


Is javascript a programming language?

949


What is eval() in javascript?

1126