Ejemplo n.º 1
0
<?php

// Question 7:
echo "The scope resolution operator(::) allows access to static properties or methods\nof a class without instantiation. Even constants can be static accessed." . PHP_EOL . PHP_EOL;
class Shopping
{
    public static function pay()
    {
        return '12,500.00' . PHP_EOL;
    }
}
echo Shopping::pay();
echo PHP_EOL . "The -> allows access to instantiated members of an object like properties or\nmethods" . PHP_EOL . PHP_EOL;
class ShoppingCart
{
    public function pay()
    {
        return '12,500.00';
    }
}
$instance = new ShoppingCart();
echo $instance->pay();