What is inheritance in php progaming?
Answer / dhanya
Inheritance is the extension of a class. A child class has
all the properties and methods of its parent class. For
example, pets generally share similar characteristics,
regardless of what type of animal they are. Pets eat, and
sleep, and can be given names. However the different types
of pet also have their own methods: dogs bark and cats meow.
Below is an implementation of this:
<?php
class Pet
{
var $_name;
function Pet($name)
{
$this->_name = $name;
}
function eat()
{
}
function sleep()
{
}
}
class Dog extends Pet
{
function bark()
{
}
}
class Cat extends Pet
{
function meow()
{
}
}
$dog = new Dog("Max");
$dog->eat();
$dog->bark();
$dog->sleep();
$cat = new Cat("Misty");
$cat->eat();
$cat->meow();
$cat->sleep();
?>
Is This Answer Correct ? | 1 Yes | 0 No |
when ever the user logged in the database table the current registered date will be appeared
Maine 12th ke bad 2 years ka web designing ka course kiya hai. Php me achcha hu. Ek fresher ko is field me kitna mil sakta hai ?
What is the purpose of the php empty function?
Which is best framework for php?
How do you explain independent and dependent variables?
What is meant by pdo in php?
What is the php function that removes the first element of the array and returns it?
Tell me how do you define a constant?
What is the importance of "action" attribute in a html form?
Explain different types of errors in PHP (i.e. arguments in errorreporting function)?
8 Answers Base2 Infotech, DCI, Microsoft, Tata Elxsi,
Explain mysql_error().
how to make website package setup like desktop software setup ... that front end and backend can include in setup like single package...?