Exemplo n.º 1
0
        $this->text = $text;
        echo 'hello from articles';
    }
    public function view()
    {
        echo $this->title;
    }
}
class NewsArticle extends Article
{
    private $date;
    //public function __construct($title, $text) {
    //    parent::__construct($title, $text);
    //    echo 'hello from news';
    //}
    public function setDate($date)
    {
        $this->date = $date;
    }
    public function getDate()
    {
        echo $this->text;
    }
}
$a = new NewsArticle('Заголовок новости', 'Тестовый текст');
//
$a->title = 'title';
//$a->date = 'some date';
$a->setDate('some date');
$a->getDate();