Skip to content

Instantly share code, notes, and snippets.

@VictorFursa
Last active November 4, 2015 20:52
Show Gist options
  • Save VictorFursa/769c4aba7f63a30c4453 to your computer and use it in GitHub Desktop.
Save VictorFursa/769c4aba7f63a30c4453 to your computer and use it in GitHub Desktop.
<?php
header('Content-Type: text/html; charset=utf-8');
class Cars{
protected $mark;// марка
public $type; // тип
public $tonnage; // тонаж
protected $places; // места
public function setMark($mark,$places){
echo $mark . " " . $places . " мест";
}
}
class Truck extends Cars {
public function __construct(){
echo $this->mark = "MAN ";
echo $this->type = "Грузовик ";
echo $this->tonnage = 20 ." тон";
}
}
class Bus extends Cars{
public function __construct($mark,$places){
echo $mark . " " . $places . " мест";
}
public function GetMark()
{
echo $this->mark = "RENO";
echo $this->type = " Автобус " ;
}
}
$truck = new Truck();
echo "<br>";
echo "<br>";
$bus = new Bus("Газель",20);
echo "<br>";echo "<br>";
$bus->GetMark();
echo "<br>";
$bus->setMark("Volvo",70);
echo "<br>";
$bus->setMark("Газель",100500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment