Beispiel #1
0
 public function f()
 {
     Car::getMake();
 }
Beispiel #2
0
<?php

include 'classes/car.php';
//using public properties
$car1 = new Car();
// $car1 -> make = 'Toyota';
// echo $car1 -> make.'<br />';
//
// $car1 -> make = 'Toyota';
// $car1 -> make = 'Honda';
// echo $car1 -> make.'<br />';
//using a public method
$car1->start();
$car1->setMake('Chevy');
echo $car1->getMake() . '<br />';
//constructors
// $car2 = new Car;
$car2 = new Car('Honda', 'Accord', 'Red');
echo $car2->getColor() . '<br />';
$car3 = new Car('Honda', 'Civic', 'Blue');
echo $car3->getColor() . '<br />';