Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Entity {
- private $type;
- public function __construct($type) {
- $this->type = $type;
- }
- public function getType() {
- return $this->type;
- }
- }
- class Animal extends Entity {
- public function __construct($type) {
- parent::__construct($type);
- }
- }
- class Dog extends Animal {
- private $tag;
- public function __construct($tag) {
- parent::__construct("Dog");
- $this->tag = $tag;
- }
- public function getTag() {
- return $this->tag;
- }
- }
- $dog = new Dog("Dog");
- echo $dog->getTag();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement