예제 #1
0
 public function __construct()
 {
     // Create a new Lunch
     $Lunch = new Sandwich();
     // Print a description of this Lunch
     print $Lunch->getDescription() . " \$" . $Lunch->price() . "\n";
     // Create another Lunch
     $Lunch2 = new Burrito();
     // Add Cheese
     $Lunch2 = new Cheese($Lunch2);
     // Add Veggies
     $Lunch2 = new Veggies($Lunch2);
     // Print a description of this Lunch
     print $Lunch2->getDescription() . " \$" . $Lunch2->price() . "\n";
     // Create a third Lunch
     $Lunch3 = new PadThai();
     // Add Tofu
     $Lunch3 = new Tofu($Lunch3);
     // Add Cheese
     $Lunch3 = new Cheese($Lunch3);
     // Add Veggies
     $Lunch3 = new Veggies($Lunch3);
     // Print a description of this Lunch
     print $Lunch3->getDescription() . " \$" . $Lunch3->price() . "\n";
 }