Why Study Design Patterns:
1, more in-depth understanding of object-oriented thinking
2, is conducive to the development of a strong extension of things
What is a design pattern: a typical solution for a typical scenario that often occurs is the design pattern. For example, in the life of the design patterns: such as the idea of girls, chess tricks and so on. So how to learn design patterns? Typical scenario-"typical problem"--typical solution
Polymorphic
Polymorphism is a biological concept, refers to the same kind of various forms of expression, such as: Crucian carp generally in a catty or so, silver carp generally in more than 10 kilograms, in object-oriented, refers to some kind of object (such as a tiger) instances of different manifestations, such as some tigers will climb trees, some will not. In a strongly typed language Java, function parameters, function return values are dead, and when a class wants to implement different processing, we usually only declare abstract class, specific work is done by the subclass object, because the subclass belongs to the parent class, so when we use, passed the parent class object can implement different functions, This is the polymorphism of Java. PHP is a weak type of language, a variable does not have a type, you can do anything, the same, there is no mandatory type of parameters, the transfer of anything, so for the PHP dynamic language, is not polymorphic, but the metamorphosis, in order to make PHP not so flexible, we have to restrict the parameter type, the parameter is the parent class, pass its subclasses PHP language itself is polymorphic, after php5.3, the introduction of object type parameter detection (can only detect the object belongs to the Class), which limits the flexibility for PHP, to achieve the multi-state effect in Java
thinking: Polymorphism is actually referring to the abstract declaration of the parent class, the specific work of sub-class object completion, such as the completion of different subclass objects, there are different characteristics .
Cond...
PHP Object-oriented design pattern