This repository has been archived on 2026-06-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
sgd/ysqld/ysql05d/erweiterte_kindklasse.php
T

48 lines
1.4 KiB
PHP

<!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>