我有一个具有多个数值和功能的类(对于某种计数类别等)
class mBasicClass
{
public $typ01Value = 0;
public $typ02Value = 0;
}
我还有一些其他类实际上是这些类的组
class mClass
{
public $vjA = new mBasicClass();
public $ntB = new mBasicClass();
public $ntC = new mBasicClass();
public $ntD = new mBasicClass();
}
我想知道的-有没有办法在php类中编写像.net这样的运算符覆盖
这样我就可以使用
$vjA + $ntB
实际上是
$vjA->$typ01Value + $ntB ->$typ01Value
$vjA->$typ02Value + $ntB ->$typ02Value