Advertisement
yesamarcos

Como escrever essa classe de uma forma mais profissional?

Sep 28th, 2016
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. class ContaCorrente {
  4.  
  5.     // private $creditos = 1200;
  6.     // private $debitos = 650;
  7.  
  8.     public function MostraSaldo()
  9.     {
  10.         $mostraSaldo = $this->CalculaSaldo($this->creditos, $this->debitos);
  11.         return $mostraSaldo;
  12.     }
  13.  
  14.     public function CalculaSaldo($creditos, $debitos)
  15.     {
  16.         $this->creditos = $creditos;
  17.         $this->debitos = $debitos;
  18.  
  19.         $saldo = $creditos - $debitos;
  20.  
  21.         return $saldo;
  22.     }
  23. }
  24.  
  25. ###################################################
  26. ###################################################
  27.  
  28. $obj = new ContaCorrente;
  29.  
  30. $obj->CalculaSaldo(1200, 600);
  31.  
  32. echo $obj->MostraSaldo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement