Is dynamic polymorphism in PHP supported as template classes, or is abstract function and overload / override the only way to use polymorphism in PHP?
This should enlighten you: http://net.tutsplus.com/tutorials/php/understanding-and-applying-polymorphism-in-php/
There is nothing like template classes, but you can achieve very different behaviors when using abstract classes and interfaces, as well as using design patterns such as State, Decorator, Strategy and others.
related: PHP ?
, .
You can use interfaces to add common functions to classes. Of course, you can also override certain functions and extend classes. The most common way that I polymorphize the functionality of my classes begins with a base (template) class and extends it for each fork in the tree of its use.
Source: https://habr.com/ru/post/1775878/More articles:Using a WPF polygon in another thread - multithreadingMySQL Conditional Where clause - mysqlРазвертывание сайта Maven завершается с отказом SCP Connection - Windows - javaDjango - ChoiceField - selection buttons instead of selection window - djangoEntity Structure and Views - sql-server-2008Coffeescript, как бы я написал этот пример в виде очереди, особенно цикл? - javascriptDoes JPA have the equivalent of Hibernate SQLQuery.addScalar ()? - hibernateThe FTP site is working, but I cannot connect to the Java program. I get java.net.UnknownHostException - javaWhat is the point of the stored procedure? - mysqlGet javascript comments in javascript or how to parse js in js? - javascriptAll Articles