另一个对象内的对象数组 - PHP [关闭]

My problem is below:

class AClass{
   BClass objB;
   CClass objC = array();
}

$objC1 = new CClass();

$objC1->x = data; .....

$objA1 = new AClass();
$objA1->objC[] = $objC1;

So what i want to do is, there is an array of CClass objects, which should go inside AClass.

Tries arrayobjects, push etc. no luck.

Thanks in Advance.

As mentioned in my comment, PHP does not support typed class properties. I would control access to the objC property via methods which can have typed arguments. For example

class AClass {
    private $objB;
    private $objC = array();

    public function addC(CClass $obj) {
        $this->objC[] = $obj;
    }
}

$objA1 = new AClass;
$objA1->addC($objC1);