<?php
class Counter {
protected $show0;
protected $show1;
function __construct($arg0, $arg1) {
$this->show0 = $arg0;
$this->show1 = $arg1;
}
function Res() {
return ($this->show1 - $this->show0);
}
}
//производный класс
class Price extends Counter {
private $price;
function __construct($arg) {
$this->price = $arg;
//конструктор базового класса
parent::__construct($args[1],$args[2]);
}
function Sum() {
return ( $this->Res() * $this->price );
}
}
$P = new Price(0.2436, 0, 120);
echo $P->Sum(), '<br />';
PD9waHAKCmNsYXNzIENvdW50ZXIgewogcHJvdGVjdGVkICRzaG93MDsKIHByb3RlY3RlZCAkc2hvdzE7CiBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkYXJnMCwgJGFyZzEpIHsKICAkdGhpcy0+c2hvdzAgPSAkYXJnMDsKICAkdGhpcy0+c2hvdzEgPSAkYXJnMTsKIH0KIGZ1bmN0aW9uIFJlcygpIHsKICByZXR1cm4gKCR0aGlzLT5zaG93MSAtICR0aGlzLT5zaG93MCk7CiB9Cn0KCi8v0L/RgNC+0LjQt9Cy0L7QtNC90YvQuSDQutC70LDRgdGBCmNsYXNzIFByaWNlIGV4dGVuZHMgQ291bnRlciB7CiBwcml2YXRlICRwcmljZTsKIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRhcmcpIHsKICAgICAkYXJncz1mdW5jX2dldF9hcmdzKCk7CiAgJHRoaXMtPnByaWNlID0gJGFyZzsKICAvL9C60L7QvdGB0YLRgNGD0LrRgtC+0YAg0LHQsNC30L7QstC+0LPQviDQutC70LDRgdGB0LAKICBwYXJlbnQ6Ol9fY29uc3RydWN0KCRhcmdzWzFdLCRhcmdzWzJdKTsKIH0KIGZ1bmN0aW9uIFN1bSgpIHsKICByZXR1cm4gKCAkdGhpcy0+UmVzKCkgKiAkdGhpcy0+cHJpY2UgKTsKIH0KfQoKJFAgPSBuZXcgUHJpY2UoMC4yNDM2LCAwLCAxMjApOwplY2hvICRQLT5TdW0oKSwgJzxiciAvPic7