I was wondering if this syntax is correct:
On Classes.php:
Class Cart {
public $Product; // an object handler will be set on this property
public function __construct($user) {
// get a product on user's cart (let's say it's only 1 product) - returns $id
$this->Product = new Product($id);
}
}
Class Product {
public function __construct($id) {
// construct goes here
}
public function Product_Method() {
// product method goes here
}
}
On Script
$cart = new Cart($user);
$product_method = $cart->Product->Product_method();
It looks alright to me, since $product is set as Public and refers to an object handler.