Ejemplo n.º 1
0
$shape = new Shape();
//Assign side lengths to the shape in question.
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
$shape->sideLengths[] = 2;
//Then put the height and width into the constructor (in that order)
$shape->__construct(6.15, 6.15, 100);
//Demos the double function
$shape->double($shape);
//Demos the printShape function
$shape->printShape();
//Rectangle
$rec = new Rectangle();
$rec->__construct(4, 8, 20, 4, 2);
$rec->printShape();
//Square
$sq = new Square();
$sq->__construct(10, 40, 0, 5);
$sq->printShape();
//Triangle
$tri = new Triangle();
$tri->__construct(35, 20, 20, 50, 50, 50);
$tri->printShape();
//Oval