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

How will you create new object in javascript?

1036


Should I learn java first or javascript?

936


How to capture the Image width and height using QTP script ? Kindly answer plz.... Thanx in adavance...

4003


Which built-in method sorts the elements of an array?

1009


What is difference between local and global scope in javascript ?

1004


Should I disable javascript?

917


Which software is best for javascript?

959


How can you create an Array in JavaScript?

1011


How to add new elements dynamically?

974


Where do I put javascript in html?

838


What is the difference between JavaScript and jscript?

1231


Explain how can you submit a form using JavaScript?

897


How to change style on an element?

947


What is the === in javascript?

874


What is the difference between sessionstate and viewstate?

921