Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 167 | | All time: 8,885 This week: 660 |
|
Description | | Author |
This package demonstrates several ways to implement polimorphism in PHP.
It provides different classes and examples that implement polimorphism in different ways as a means to create objects in such a way that applications can call different the same way but each object has their own behavior.
Currently it provides classes that implement polimorphism using abstract classes, interfaces, sub-class extensions and traits. Innovation Award
June 2019
Number 4 |
Polimorphism is a means for providing access to different objects in the same way but the objects have different behavior.
This package demonstrates how to implement polimorphism in PHP using either abstract classes, interfaces, sub-class extensions and traits.
Manuel Lemos |
| |
|
|
Innovation award
Nominee: 8x
Winner: 2x |
|
Example
<?php
require_once(dirname(__FILE__) ."/Class-Abstract-Polimorf.php");
####### Book ########
$tytulBook = "Book Manager Wydobycia";
$autorBook = "Adam Ber Book";
$cenaBook = "10 z?";
$isbn = "12-234-435-1";
$book1 = new Book();
$book1->setTytul($tytulBook);
// Tytul
echo $book1->getTytul()."<br>";
$book1->setAutor($autorBook);
// Autor
echo $book1->getAutor()."<br>";
$book1->setCena($cenaBook);
// Cena
echo $book1->getCena()."<br><br>";
$book1->setIsbn($isbn);
// Isbn
echo $book1->getIsbn()."<br><br>";
####### Komiks ########
$tytulKomiks = "Komiks Manager Wydobycia";
$autorKomiks = "Adam Ber Komiks";
$cenaKomiks = "5 z?";
$seriesNumber = "10/99";
$komiks1 = new Komiks();
$komiks1->setTytul($tytulKomiks);
// Tytul
echo $komiks1->getTytul()."<br>";
$komiks1->setAutor($autorKomiks);
// Autor
echo $komiks1->getAutor()."<br>";
$komiks1->setCena($cenaKomiks);
// Cena
echo $komiks1->getCena()."<br><br>";
$komiks1->setSeriesNumber($seriesNumber);
// Seria wydania numeru Series Number
echo $komiks1->getSeriesNumber()."<br><br>";
|
Details
PHP-polimorfizm
Ucz?c si? na testy programowania oop w PHP natrafi?em na ciekawy temat jakim jest polimorfizm.
Z racji tego, ?e ma?o by?o materia?ów na ten temat w j?zyku Polskim postanowi?em troszk? u?atwi?
nauk? przysz?ym programistom, szukaj?cym jaki? materia?ów na temat polimorfizmu, dziel?c go na kategorie.
Nie spotka?em si? z takim podzia?em, wi?c mam nadziej?, ?e dobrze zrobi?em dziel?c go na cztery kategorie.
Uwa?am podzia? na kategorie za ?atwiej przyswajalne, zrozumia?e i przejrzyste do dalszej nauki.
-
Polimorfizm Interfejsowy
-
Polimorfizm Abstrakcyjny
-
Polimorfizm Traits
-
Polimorfizm Dziedziczony
PHP-Polymorphism EN
While learning about oop programming tests in PHP, I came across an interesting topic, which is polymorphism.
Due to the fact that there were few materials on this subject in Polish, I decided to make it a little easier
learning for future programmers looking for some materials about polymorphism, dividing it into categories.
I have not met with such a division, so I hope I did well by dividing it into four categories.
I consider the division into categories to be more easily absorbed, understandable and transparent for further learning.
-
Interface Polymorphism
-
Polymorphism Abstract
-
Polymorphism Traits
-
Polymorphism Inherited
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.