Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Exercio 04b</title>
- </head>
- <body>
- <pre>
- <?php
- require_once 'Armario.php';
- $arm1 = new Armario("Camiseta","Calças","Shorts");
- //$arm1-> setGaveta1("Camisetas");
- //$arm1-> setGaveta2("Calças");
- //$arm1-> setGaveta3("Shorts");
- echo "<br>";
- print_r($arm1);
- echo "<br>";
- echo "Gaveta 1 {$arm1->getGaveta1()} , gaveta 2 {$arm1->getGaveta2()} e gaveta 3 {$arm1->getGaveta3()}";
- ?>
- </pre>
- </body>
- </html>
- //Classe//
- <?php
- class Armario{
- private $gaveta1;
- private $gaveta2;
- private $gaveta3;
- private $fechar;
- public function __construct($g1,$g2,$g3){
- $this->gaveta1=$g1;
- $this->gaveta2=$g2;
- $this->gaveta3=$g3;
- $this->fecha();
- }
- public function fecha(){
- $this->fechar=true;
- }
- public function getGaveta1(){
- return $this->gaveta1;
- }
- public function setGaveta1($g1){
- $this->gaveta1=$g1;
- }
- public function getGaveta2(){
- return $this->gaveta2;
- }
- public function setGaveta2($g2){
- $this->gaveta2=$g2;
- }
- public function getGaveta3(){
- return $this->gaveta3;
- }
- public function setGaveta3($g3){
- $this->gaveta3=$g3;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement