T
Either comparing an inheritance and a class object is completely incorrect. It's two completely different things.Succession is a principle.Class object is... Subject.We'll take an example from the Jean-Claude comment.There's a Furnace class. This class describes certain properties and actions common to all furniture that can be produced with furniture.Material, weight, dimensions, colour, etc.Methods: Collect, clean, break, lift the elevator, etc.There's also a Stup class, which has all the properties and methods of "Mebelle," but also has its unique, unique relevance only to "Stules." Like the number of legs, the back.In fact, the Stul class inherits from the Furnace class.Now, imagine a specific chair you're sitting on right now, that's the object of the Stul class.In your case:$this-national_pdo is class PDO.UtilityIn two cases, inheritance is mainly used:You have many things in common. For example, you parish "road events" with the card index. Then you do this:class Event{
public $lon; //широта, долгота, время создания
public $lat;
public $time;
}
And you inherit from him the specific classes of "TV," "Driver Work," "Probka," etc.class Accident extends Event{
public $text;
public $type;
}
You want to expand a library class. For example, you really want mysqli object to have a printError method.class MyMysqli extends mysqli{
public function printError(){
echo "Аааааа! Ошибка!!!! ".$this->error;
}
}
PS as a whole, the pursuit should be careful, because it is easy to turn into something that doesn't burp, and by fixing something small in one place, you're gonna break the whole logic of the annex.