Created
June 15, 2019 15:40
-
-
Save NandoKstroNet/29289566f1f1025733e3c1a3110bc58d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Conta | |
{ | |
private $saldo; | |
public function depositar($valor) | |
{ | |
// $this->saldo = $this->saldo + $valor; | |
$this->saldo += $valor; | |
} | |
public function sacar($valor) | |
{ | |
$this->saldo -= $valor; | |
} | |
public function getSaldo() | |
{ | |
return $this->saldo; | |
} | |
} | |
$conta = new Conta(); | |
$conta->depositar(10); | |
print $conta->getSaldo() . "\n"; | |
$conta->depositar(10); | |
print $conta->getSaldo() . "\n"; | |
$conta->sacar(10); | |
print $conta->getSaldo() . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment