Skip to content

Instantly share code, notes, and snippets.

@genkovich
Created April 20, 2021 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genkovich/bf13d4e38d75a74ac0938a64493d2f8c to your computer and use it in GitHub Desktop.
Save genkovich/bf13d4e38d75a74ac0938a64493d2f8c to your computer and use it in GitHub Desktop.
<?php
class Deposit
{
protected float $account = 0;
public function __construct(float $sum)
{
if ($sum < 0) {
throw new Exception('Сумма вклада не может быть меньше нуля');
}
$this->account += $sum;
}
}
class VipDeposit extends Deposit
{
public function getMoney(float $sum)
{
$this->account -= $sum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment