diff --git a/17-ClassDogs.php b/17-ClassDogs.php new file mode 100644 index 0000000..2611edb --- /dev/null +++ b/17-ClassDogs.php @@ -0,0 +1,58 @@ + name = $name1; + $this -> breed = $breed1; + $this->age = $age1; +} + +public function getDogsData() { + + $data = " +

Data Dogs

+ Name : {$this->name}
+ Breed : {$this ->breed}
+ Age : {$this->age}
+ "; + return $data; +} +} + +/* 3 methods Formats !!! + + +public function setName () { + return $this -> name; +} + +public function getName ($name) { + $this -> name = $name; + return $this -> name; +} + +public function setBreed () { + return $this -> breed; +} + +public function getBreed ($breed) { + $this -> breed = $breed; + return $this; +} + +public function setAge () { + return $this -> age; +} + +public function getAge ($age) { + $this -> age = $age; + return $this; +} */ + + +?> \ No newline at end of file diff --git a/18-ClassDogs2.php b/18-ClassDogs2.php new file mode 100644 index 0000000..45b4364 --- /dev/null +++ b/18-ClassDogs2.php @@ -0,0 +1,35 @@ + name = $name1; + $this -> firstName = $firstName; + $this -> breed = $breed1; + $this-> age = $age1; + $this -> type = $type1; + } + + public function __destruct() { + echo "This properties get deleted: ".$this-> name; + } + + public function getDogsData1() { + + $data1 = " +

Data Dogs 2

+ Name : {$this->name}
+ First Name : {$this->firstName}
+ Breed : {$this ->breed}
+ Age : {$this->age}
+ Type : {$this->type}

+ "; + return $data1; + } +} + +?> \ No newline at end of file diff --git a/19-indexdogs.php b/19-indexdogs.php new file mode 100644 index 0000000..08671a2 --- /dev/null +++ b/19-indexdogs.php @@ -0,0 +1,19 @@ +getDogsData(); + +echo $pet1; + +require_once("ClassDogs2.php"); + +$dog2 = new Dogs2( "Maxi", "Max", "Bulldog", 10, "Dog"); + +$pet2 = $dog2->getDogsData1(); + +echo $pet2; + +?> \ No newline at end of file diff --git a/20-ClassAbstract.php b/20-ClassAbstract.php new file mode 100644 index 0000000..97f74ae --- /dev/null +++ b/20-ClassAbstract.php @@ -0,0 +1,25 @@ + name = $name; + $this->age = $age; + } + + public function getAnimalsData() { + + $data = " +

Animals Data

+ Name : {$this->name}
+ Age : {$this->age} + "; + return $data; +} +} + +?> \ No newline at end of file diff --git a/21-ClassInterface.php b/21-ClassInterface.php new file mode 100644 index 0000000..6e944ed --- /dev/null +++ b/21-ClassInterface.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/README.md b/README.md index e644e6a..07aaab1 100644 --- a/README.md +++ b/README.md @@ -134,3 +134,16 @@ Namespaces are qualifiers that solve two different problems: 2. They allow the same name to be used for more than one class In this file you will learn how to create and use namespaces. + +### [17 - ClassDogs](17-ClassDogs.php) + +### [18 - ClassDogs2](18-ClassDogs2.php) + +### [19 - IndexDogs](19-IndexDogs.php) + +### [20 - Abstract](20-ClassAbstract.php) + +### [21 - Interface](21-ClassInterface.php) + + +These Basics seemed simple but nothing beyond reality, when documenting you see that the methods can be developed in different ways and I commented on one of them because I did not know which one was correct, although the result is the same. For the rest it contains many very interesting sections. \ No newline at end of file