patryk-developer
6/3/2018 - 9:29 PM

Nadpisywanie metod

Odwołanie do klasy bazowej SUPER / PARENT / BASE

<?php
 
class BussinessAccount extends Account {
  
}
 
$businessAcc = new BussinessAccount(400);
print_r($businessAcc->getBalance());
 
 
 
class SavingAccount extends Account {
  private $interestRate;
  
  public function __construct($balance, $interestrate) {
    parent::__construct($balance);
    $this->interestRate = $interestRate;
  }
}

$savingAcc = new SavingAccount(400, 0.05);
print_r($savingAcc);
?>