Estoy empezando con POO y me gustaría que vean esta simple clase.
Código PHP:
Ver originalclass math {
private $x;
private $y;
private $iva;
public function __construct($iva) {
$this->iva = $iva;
}
public function suma($valor1, $valor2) {
$this->x = $valor1;
$this->y = $valor2;
$sumar = $this->x + $this->y;
return $sumar;
}
public function resta($valor1, $valor2) {
$this->x = $valor1;
$this->y = $valor2;
$restar = $this->x - $this->y;
return $restar;
}
public function division($valor1, $valor2) {
$this->x = $valor1;
$this->y = $valor2;
$dividir = $this->x / $this->y;
return $dividir;
}
public function calculariva($valor) {
$iva = ($valor * $this->iva) / 100;
return $iva;
}
}