diff --git a/01-classes.php b/Doc/01-classes.php similarity index 100% rename from 01-classes.php rename to Doc/01-classes.php diff --git a/02-properties.php b/Doc/02-properties.php similarity index 100% rename from 02-properties.php rename to Doc/02-properties.php diff --git a/03-methods.php b/Doc/03-methods.php similarity index 100% rename from 03-methods.php rename to Doc/03-methods.php diff --git a/04-getters.php b/Doc/04-getters.php similarity index 100% rename from 04-getters.php rename to Doc/04-getters.php diff --git a/05-setters.php b/Doc/05-setters.php similarity index 100% rename from 05-setters.php rename to Doc/05-setters.php diff --git a/06-constructors.php b/Doc/06-constructors.php similarity index 100% rename from 06-constructors.php rename to Doc/06-constructors.php diff --git a/07-inheritance-problem.php b/Doc/07-inheritance-problem.php similarity index 100% rename from 07-inheritance-problem.php rename to Doc/07-inheritance-problem.php diff --git a/08-inheritance-solution.php b/Doc/08-inheritance-solution.php similarity index 100% rename from 08-inheritance-solution.php rename to Doc/08-inheritance-solution.php diff --git a/09-public-private-protected.php b/Doc/09-public-private-protected.php similarity index 100% rename from 09-public-private-protected.php rename to Doc/09-public-private-protected.php diff --git a/10-static.php b/Doc/10-static.php similarity index 100% rename from 10-static.php rename to Doc/10-static.php diff --git a/11-const.php b/Doc/11-const.php similarity index 100% rename from 11-const.php rename to Doc/11-const.php diff --git a/12-abstract-classes.php b/Doc/12-abstract-classes.php similarity index 100% rename from 12-abstract-classes.php rename to Doc/12-abstract-classes.php diff --git a/13-interfaces.php b/Doc/13-interfaces.php similarity index 100% rename from 13-interfaces.php rename to Doc/13-interfaces.php diff --git a/14-overriding.php b/Doc/14-overriding.php similarity index 100% rename from 14-overriding.php rename to Doc/14-overriding.php diff --git a/15-overloading.php b/Doc/15-overloading.php similarity index 100% rename from 15-overloading.php rename to Doc/15-overloading.php diff --git a/16-namespaces.php b/Doc/16-namespaces.php similarity index 100% rename from 16-namespaces.php rename to Doc/16-namespaces.php diff --git a/mobileLibs.php b/Doc/mobileLibs.php similarity index 100% rename from mobileLibs.php rename to Doc/mobileLibs.php diff --git a/OOP DOC.pdf b/OOP DOC.pdf new file mode 100644 index 0000000..6111fc7 Binary files /dev/null and b/OOP DOC.pdf differ diff --git a/oop.php b/oop.php new file mode 100644 index 0000000..e3df4a9 --- /dev/null +++ b/oop.php @@ -0,0 +1,146 @@ +brand = $brand; + $this->modelName = $modelName; + $this->size = $size; + $this->width = $width; + $this->thickness = $thickness; + $this->volume = $volume; + } + + // FUNCTION TO GET BRAND NAME------------------ + public function getBrand() + { + return $this->brand; + } + + // FUNCTION TO GET VOLUME IN LITERS + public function getVolume() + { + return $this->volume; + } +} + + + +class Surf extends Board +{ + + const LOGO = "PYZEL Logo: "; + # PROPERTIES ------------------ + public $tailType; + public $finsSystem; + public $finsNumber; + + public static $leashHolder = "Standard"; + + # METHODS ---------- + # CONSTRUCTOR ------------ + public function __construct( + string $tailType, + string $finsSystem, + int $finsNumber + ) { + parent::__construct("Pyzel", "Ghost", "5' 8''", "18 3/4", "2 5/16", "24,7 Litros"); + $this->tailType = $tailType; + $this->finsSystem = $finsSystem; + $this->finsNumber = $finsNumber; + } + + + // FUNCTION TO REMOVE FINS (MIN 0)------------------ + + public function removeFins() + { + $minFins = "You have removed all your fins"; + + if ($this->finsNumber === "You have set all your fins") { + $this->finsNumber = 4; + } + + if ($this->finsNumber === 0) { + $this->finsNumber = $minFins; + } else if ($this->finsNumber !== 0) { + $this->finsNumber--; + } + + return $this->finsNumber; + } + + // FUNCTION TO ADD MORE FINS (MAX 5)------------------ + public function addFins() + { + if ($this->finsNumber === "You have removed all your fins") { + $this->finsNumber = 1; + } + + $maxFins = "You have set all your fins"; + + if ($this->finsNumber === 5) { + $this->finsNumber = $maxFins; + } else if ($this->finsNumber <= 5) { + + $this->finsNumber++; + } + + return $this->finsNumber; + } +} + + +$newSurfboard = new Surf("Round Spin", "Futures", 3); + +echo "
";
+echo "getVolume();
+
+// echo "
"; +// echo "
"; + +// echo "Change your Fins!" . "\n"; +// echo "Removed 1 fin! Nº of Fins = " . $newSurfboard->removeFins() . "\n"; +// echo "
"; +// echo "Removed 1 fin! Nº of Fins = " . $newSurfboard->removeFins() . "\n"; +// echo "
"; +// echo "Removed 1 fin! Nº of Fins = " . $newSurfboard->removeFins() . "\n"; +// echo "
"; + +// echo $newSurfboard->removeFins() . "\n"; + +// echo "
"; + +// echo "Added 1 fin! Nº of Fins = " . $newSurfboard->addFins() . "\n"; +// echo "
"; +// echo "Added 1 fin! Nº of Fins = " . $newSurfboard->addFins() . "\n"; +// echo "
"; +// echo "Added 1 fin! Nº of Fins = " . $newSurfboard->addFins() . "\n"; +// echo "
"; +// echo "Added 1 fin! Nº of Fins = " . $newSurfboard->addFins() . "\n"; +// echo "
"; +// echo $newSurfboard->addFins(); \ No newline at end of file