Guest User

Untitled

a guest
May 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?
  2. abstract class Good{
  3. private $cost;
  4.  
  5. public function setCost($cost){
  6. $this->cost=$cost
  7. }
  8. public function getCost(){
  9. return $this->cost;
  10. }
  11.  
  12. abstract public function toCount();
  13.  
  14. public function finalCost(){
  15. return $this->toCount()*0.2;
  16. }
  17.  
  18. class GoodDigital extends Good{
  19.  
  20. public function toCount(){
  21. return $this->getCost*0.5;
  22. }
  23. }
  24.  
  25.  
  26. class GoodPiece extends Good{
  27. public function toCount(){
  28. return $this->getCost;
  29. }
  30. }
  31.  
  32. class Good_By_Mass extends Good{
  33.  
  34. private $mass;
  35.  
  36. public function setMass($mass){
  37. $this->mass = $mass;
  38. }
  39. public function getMass(){
  40. return $this->mass;
  41. }
  42.  
  43. public function toCount(){
  44. return $this->getCost()* $this->getMass();
  45. }
  46. } ?>
Add Comment
Please, Sign In to add comment