Factory
来源:互联网 发布:lua for windows 64 编辑:程序博客网 时间:2024/05/21 06:23
<?php
class Factory {
private $_store = array();
function __construct(){
}
public function get($key) {
if(isset($this->_store[$key])) {
return $this->_store[$key];
}
return null;
}
public function set($key, $value = null) {
if($key){
$this->_store[$key] = $value;
}
}
}
$f1 = new Factory();
$f2 = new Factory();
$f1->set('f1','f1');
$f2->set('f2','f2');
var_dump($f1,$f2,$f1===$f2);
class Factory {
private $_store = array();
function __construct(){
}
public function get($key) {
if(isset($this->_store[$key])) {
return $this->_store[$key];
}
return null;
}
public function set($key, $value = null) {
if($key){
$this->_store[$key] = $value;
}
}
}
$f1 = new Factory();
$f2 = new Factory();
$f1->set('f1','f1');
$f2->set('f2','f2');
var_dump($f1,$f2,$f1===$f2);
- Factory
- factory
- factory
- Factory
- Factory
- factory
- Factory
- Factory
- factory
- Factory
- Factory
- Factory
- factory
- Factory
- factory
- Factory
- Factory
- Factory
- adapter
- ios6 设备旋转以及获取设备方向
- C++著名类库
- Decorator
- 如何最简单地在mac pro双系统(mac+xp)下重装windows
- Factory
- linux c 简单的ls程序编写 学习笔记
- js RegExp用法
- Observer
- 线程和优先级总结
- Proxy
- 关于齐次坐标的理解
- PHP异步执行的常用方式
- 线程优先级