Skip to content

Instantly share code, notes, and snippets.

@VictorFursa
Last active September 1, 2016 06:39
Show Gist options
  • Save VictorFursa/0c90b3c2b3afdfa74d43523fade8808b to your computer and use it in GitHub Desktop.
Save VictorFursa/0c90b3c2b3afdfa74d43523fade8808b to your computer and use it in GitHub Desktop.
Warcraft
<?php
abstract class Character {
protected $spells = [];
abstract public function getTalants();
}
<?php
require_once "Character.php";
class Mage extends Character {
private function Talant(){
return $this->spells = ['Фрост нова', 'ГЛЫБА'];
}
public function getTalants(){
foreach ($this->Talant() as $value)
{
echo $value . '<br>';
}
}
}
$mage = new Mage();
$mage->getTalants();
<?php
require_once "Character.php";
class Warrior extends Character {
private function Talant(){
return $this->spells = ['Героический прыжок', 'чардж'];
}
public function getTalants(){
foreach ($this->Talant() as $value)
{
echo $value . '<br>';
}
}
}
$war = new Warrior();
$war->getTalants();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment