如题所述
第1个回答 2017-03-31
提问的哥们是不是想问:怎么调用构造函数的结果?
我的思路的这样的:
类里面申明一个变量public $xxoo;
function __construct(){
$this->xxoo = $result;//$re表示构造函数结果
}
function aabb(){
$xxoo=$this->xxoo;//aabb函数里面的$xxoo就可以调用构造函数的结果了
}
我的思路的这样的:
类里面申明一个变量public $xxoo;
function __construct(){
$this->xxoo = $result;//$re表示构造函数结果
}
function aabb(){
$xxoo=$this->xxoo;//aabb函数里面的$xxoo就可以调用构造函数的结果了
}
第2个回答 2012-02-10
不能
第3个回答 2012-02-16
不能,构造方法可以进行赋值,例如将类里面的属性初始化,或者通过传入的值进行赋值。
例如,java写法:
Dog(String name){
this.name = name;
}本回答被网友采纳
例如,java写法:
Dog(String name){
this.name = name;
}本回答被网友采纳