echo paint("bedroom");
echo paint("blue");
//You have to pay attention to the order of the paramters you're passing!
//A simple inheritance example, where the parent class' method "honk" is accessed using two different syntaxes.
class Vehicle
{
    public function honk()
    {
        return "HONK HONK!";
    }
}
class Bicycle extends Vehicle
{
}
$bicycle = new Bicycle();
echo $bicycle->honk() . "<br>";
echo Bicycle::honk() . "<br>";
//The :: is a "scope resolution operator".  However, according to strict standards, one should not call a non-static method statically.
//Accessing a parent class constant const (notice no $ before the constant's name) without creating an object
class Hi
{
    const hi = "hello";
}
class HelloWorld extends Hi
{
}
echo HelloWorld::hi;
//The :: is a "scope resolution operator"
echo "<br>";
echo "<br>";
//Here is the necessary syntax for a constructor, although the number of variables can change
Esempio n. 2
0
<html>
  <head>
    <title>Sobreposição!</title>
  </head>
  <body>
    <p>
      <?php 
class Vehicle
{
    public function honk()
    {
        return "HONK HONK!";
    }
}
// Adicione seu código abaixo!
class Bicycle extends Vehicle
{
    public function honk()
    {
        return "Beep beep!";
    }
}
$bicycle = new Bicycle();
echo $bicycle->honk();
?>
    </p>
  </body>
</html>