I am trying to make abstract method clear to me , so I wrote this code and test it. But when I run it the following error appear :
Fatal error: Class Book contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Book::ClassName) in C:\AppServ\www\index2.php on line 5
so where is the problem and why ?
<?php
class Book
{
abstract public function ClassName();
}
class firstBook extends Book{
public function ClassName()
{
echo "Called form class firstBook";
}
}
class secondBook extends Book{
public function ClassName()
{
echo "Called from class secondBook";
}
}
$o = new firstBook();
$o2 = new secondBook();
$o->Classname();
$o2->Classname();
?>