<?php
$size = new Size(10, 10);
$point = new Point(5, 5);
$rect = new Rect($size, $point);
print_r($rect);
//In PHP there are no struct type
class Size {
public $width;
public $height;
public function __construct($width, $height) {
$this->width = $width;
$this->height = $height;
}
}
class Point {
public $left;
public $top;
public function __construct($left, $top) {
$this->left = $left;
$this->top = $top;
}
}
class Rect {
public $size;
public $point;
public function __construct($size, $point) {
$this->size = $size;
$this->point = $point;
}
}