PHP Mysql extending class

So, lets say you want to extend php/mysql class we were talking about earlier.

class nastavak extends baza {

private $nast;
private $drugi;

public function __construct(){
echo "This is the extended class";
parent::__construct("","root","","test");
parent::sqlquery("select * from imena");
parent::stampaj();
}
}

What happened here? Well, we have added another class on top of baza class and that way we have extended it. It means new class (extended) has everything from parent class (baza) and what we have added inside of it (nastavak).

Overriding in the next article.

Leave a Reply

Your email address will not be published. Required fields are marked *