12-18-2007, 10:05 AM
|
#1 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
|
Help me find this tutorialsite?
Hey guys,
A couple of days ago, maybe longer than I week, I did some tutorials about OOP. Simply learning and trying as we go. 'Updating' the info somewhat.
Anyway, I found this site, and I believe the link came from TalkPHP, which has a tutorial about OOP. 2 to be exact. The one was about a CAR Class. This is what I copied from the site.
PHP Code:
<?php
class Car
{
public $color;
public $horsepower;
public $speed;
public $name;
public $engineStatus;
function __construct()
{
$this->color = "Silver";
$this->horsepower = 450;
$this->name = "Aston Martin DB9";
$this->speed = 0; //stationary
$this->engineStatus = "Off";
$this->StartCar();// jump to the Startup function below
}
function __destruct()
{
echo "Car has crashed!!!";
}
public function StartCar()
{
$this->engineStatus = "On";
echo "Engine is now running<br>";
}
public function SpeedUp($speed)
{
$this->speed = $speed;// set speed to 20
echo "Car is now moving at ".$speed." Mph<br>";//display a confirmation message
}
public function StopCar()
{
$this->speed = 0;
echo "Car stopped!<br>";
}
public function StopEngine()
{
$this->engineStatus = "Off";
echo "Engine is not running<br>";
}
}
?>
The site style was dynamicly changing with javascript and the basic colors where orange and black/darkgrey.
Can you guys help me out here? :-S
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|