-
Notifications
You must be signed in to change notification settings - Fork 0
smallearth/Factory_method_php
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A factory method example in PHP. 目录结构 Creator -- 工厂 Creator.php -- 工厂抽象类 FruitCeator.php -- 水果工厂 Product----产品 Product.php -- 产品抽象类 AppleProduct.php -- 苹果产品 BananaProduct.php -- 香蕉产品 Helper-————帮助类 Client.php-客户 调用: $Client = new Client(); echo "\n"; echo "Jack: Hi give me an Apple!\n"; echo "\n"; echo "Product: " . $Client->getApple() . "\n"; 结果: Jack: Hi give me an Apple! Product: I am apple! 调用: $Client = new Client(); echo "\n"; echo "Jack: Hi give me an Banana!\n"; echo "\n"; echo "Product: " . $Client->getApple() . "\n"; echo "\n"; 结果: Jack: Hi give me an Banana! Product: I am apple!
About
A factory method example in PHP.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published