小编use*_*090的帖子

php:自定义类型的属性

我正在尝试编写以下代码,虽然它是错误的,但它可能会证明我为什么要这么做.

class myClass
{
    private $name = "";
    private $startAddress = new myAddress();  // this is the issue
    private $endAddress = new myAddress();    // this is the issue
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

谢谢

php properties

1
推荐指数
1
解决办法
1034
查看次数

标签 统计

php ×1

properties ×1