I want to have an interface, let's name it as IPage.
Then I want to have an abstract class which implements IPage, and have for some of the functions in IPage implimetations and some are abstract.
Then I have a class which extends the abstract class (which implments IPage) and this class should contain the implimetations of abstract functions in the abstract class which it extends + some override for "default" functions I have in the abstract class.
I tried it:
IPage.php:
Code: Select all
<?php
interface IPage {
public function ShowPage($pageProperties);
public function GetHeaderInformation();
public function SetDb($db);
}
?>
Code: Select all
<?php
abstract class Page implements IPage
{
var $_db;
public function SetDb($db) {
$this->_db = $db;
}
public function GetHeaderInformation() {
$pageInformation = new PageInformation();
return $pageInformation();
}
public abstract function ShowPage();
}
?>
Code: Select all
<?php
class SpeceficPage extends Page
{
public function ShowPage()
{
echo "Page Content";
}
}
?>
Code: Select all
<?php
require "interfaces/IPage.php";
require "abstract/Page.php";
require "pages/about.php";
$aboutPage = new SpeceficPage();
$aboutPage->ShowPage();
?>
Fatal error: Can't inherit abstract function IPage::ShowPage() (previously declared abstract in Page) in /home/virtual/talaviel/public_html/tries/abstract/Page.php on line 2
Someone can help me??
Thank you !
Tal