File: index.php

Recommend this page to a friend!
  Classes of Bogdan T. Gersak  >  Composite Pattern  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: How to use it
Class: Composite Pattern
Implementation of the composite design pattern
Author: By
Last change:
Date: 11 years ago
Size: 460 bytes


Class file image Download
require_once 'AbstractTrain.php';

$newTrain = new Train('Train M1');
$newTrain->addWagon(new Wagon('Wagon 1'));
$newTrain->addWagon(new Wagon('Wagon 2'));
$newTrain->addWagon(new Wagon('Wagon 3'));

$newWagon = new Wagon('Wagon M4');

//U can't add a train to a wagon

//Check Train and Wagon

"<br />";


For more information send a message to info at phpclasses dot org.