Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // constructor abstracto
- abstract class AbstractFactory
- {
- // el tipo que devolverá esta función factory será ejemplo abstracto
- abstract public function FactoryMethod(...$params);
- }
- // constructor concreto
- class ConstructorConcreto extends AbstractFactory
- {
- public function FactoryMethod(...$params)
- {
- return new EjemploConcreto(...$params);
- }
- }
- // ejemplo abstracto
- abstract class EjemploAbstracto { }
- // ejemplo concreto
- class EjemploConcreto extends EjemploAbstracto
- {
- public function __construct()
- {
- //...
- }
- }
- $factory = new ConstructorConcreto();
- $ejemplo = $factory->FactoryMethod();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement