can we create a final method in abstract class ?
can we create a abstract method in final class ?
pls give me explanation with coding.
Thanks advance for your answer.
can we create a final method in abstract class ?
can we create a abstract method in final class ?
pls give me explanation with coding.
Thanks advance for your answer.
1) can we create the final method in abstract class .
yes we can .
see the below code for further reference /* final method in abstract class */
abstract class base {
public $name;
abstract public function getName();
final public function setName($inputName) {
$this->name = $inputName;
}
}
class child extends base {
public function getName() {
echo $this->name;
}
}
$obj = new child();
$obj->setName('Software Engineer');
$obj->getName();
2 . can we create a abstract method in final class ? No. we can not create the abstract method in final class,