php
class MyClass {
private $obj;
public function __construct(Object $obj) {
$this->obj = $obj;
}
public function doSomething() {
// Use $this->obj here
}
}
$obj = new Object();
$myClass = new MyClass($obj);
$myClass->doSomething();
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-