Voll Upload SGD Fachinformatiker PHP
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Vererbung</title>
|
||||
<?php
|
||||
include_once("3_2_autoklasse.php")
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
class Sportwagen extends Autoklasse
|
||||
{
|
||||
private $hoechstgeschwindigkeit = 0;
|
||||
private $geschwindigkeitsBegrenzer = true;
|
||||
private $carboneBremse = true;
|
||||
|
||||
public function __construct($aktuellegeschwindigkeit, $vmax, $begrenzer, $cBremse)
|
||||
{
|
||||
parent::__construct($aktuellegeschwindigkeit);
|
||||
$this->hoechstgeschwindigkeit = $vmax
|
||||
}
|
||||
|
||||
public function setHoechstgeschwindigkeit($wert)
|
||||
{
|
||||
$this->hoechstgeschwindigkeit = $wert;
|
||||
}
|
||||
|
||||
public function getHoechstgeschwindigkeit()
|
||||
{
|
||||
return $this->hoechstgeschwindigkeit;
|
||||
}
|
||||
|
||||
public function ausgeben()
|
||||
{
|
||||
parent::ausgeben();
|
||||
echo "Die Höchstgeschwindigkeit beträgt " .$this->hoechstgeschwindigkeit ." km/h <br>";
|
||||
}
|
||||
}
|
||||
|
||||
$sw1 = new Sportwagen(250);
|
||||
|
||||
$sw1->setHoechstgeschwindigkeit(279);
|
||||
|
||||
$sw1->ausgeben();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user