Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Ordena
- {
- protected $a;
- protected $b;
- protected $c;
- //contrutor//
- /*public function __construct($a,$b,$c){
- $this->a=$aa;
- $this->b=$bb;
- $this->c=$cc;
- }*/
- //metodos especiais//
- public function getA(){
- return $this->a;
- }
- public function setA($aa){
- $this->a=$aa;
- }
- public function getB(){
- return $this->b;
- }
- public function setB($bb){
- $this->b=$bb;
- }
- public function getC(){
- return $this->b;
- }
- public function setC($cc){
- $this->c=$cc;
- }
- //fincao ordena a b c/
- public function ordenador(){
- if($this->a > $this->b & $this->b > $this->c){
- print ("a,b,c");
- }elseif($this->b > $this->c & $this->c > $this->b){
- print("b,c,a");
- }else($this->b > $this->c){
- print("b,a,c");
- }
- }
- // index
- <?php
- require 'ordena.php';
- $ord = new Ordena();
- $ord->setA(3);
- $ord->setB(2);
- $ord->setC(1);
- $ord->ordenador();
- //print_r($ord);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement