Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class calculo{
- private $valor_1;
- private $valor_2;
- //construtor
- function __construct($valor1,$valor2){
- $this->valor_1 = $valor1;
- $this->valor_2 = $valor2;
- }
- function __destroy(){}
- //metodos get e setter
- public function setValor_1($valor_1){
- $this-> $valor_1 = $valor_1;
- }
- public function getValor_1(){
- return $this-> valor_1;
- }
- public function setValor_2($valor_2){
- $this-> $valor_2 = $valor_2;
- }
- public function getValor_2(){
- return $this-> valor_2;
- }
- //funções
- function soma(){
- return $this->valor_1 + $this->valor_2;
- }
- function subtracao(){
- return $this->valor_1 - $this->valor_2;
- }
- function multiplicacao(){
- return $this->valor_1 * $this->valor_2;
- }
- function divisao(){
- return $this->valor_1 / $this->valor_2;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement