【发布时间】:2011-01-11 12:54:12
【问题描述】:
你好
我正在学习php,我在许多其他小项目中看到了许多空Function,我不知道它有什么帮助。
例子:
public function first(){
// do nothing
}
public function second(){
// do nothing
}
public function myfuntion(){
// Codes
}
另一个例子:
class user_bo{
protected $attributes = Array();
public function __get($key){
return array_key_exists($key, $this->attributes) ? $this->attributes[$key] : null;
}
public function __set($key, $value){
$this->attributes[$key] = $value;
}
/** Constructor **/
public function __construct(){ }
} ?>
__construct() 在这种情况下如何帮助我们,因为它看起来好像什么也没做?
【问题讨论】:
-
你能举个真实的例子吗?
-
你能指出你看过的资源吗?这个问题有点断章取义。
-
通常用于_examples_$
-
可能是这些函数体的实现打算在扩展(继承)类中定义
-
也许它是一个类中的函数,它被另一个类覆盖,你已经看到了......?从来没有见过很多空函数被使用