name = $name;
}
function getName() {
return $this->name;
}
public function tellme() : string {
return 'I tell ' . $this->prop;
}
}
class Normal {
}
class AbstChild extends Abst {
public function toBeReplaced($tell) : string {
return 'i fill Abst with: ' . $tell;
}
function tell() {
echo 'tschau!';
}
static function create(): AbstChild {
$normal = new AbstChild();
$normal->prop = 1;
return $normal;
}
}
$normal = AbstChild::create();
echo $normal->tellme();
//die();
/*
class NoWorkAbstChild extends Abst {
public function ifill() : string {
return "i fill";
}
}
*/
interface AInterface {
/** Interface kann kein property haben */
public function toBeReplaced() : string;
}
interface AOtherInterface {
/** Interface kann kein property haben */
public function toBeReplaced() : string;
}
class WithInterface implements AInterface, AOtherInterface {
public function toBeReplaced(): string {
return 'i fill interface';
}
}
trait TraitOne {
public function tellme() {
echo 'do tell me';
echo '
';
}
}
trait TraitTwo {
public function listenme() {
echo 'i listen you';
echo '
';
}
}
class MyMe {
use TraitOne, TraitTwo;
/** wenn mehr als 1 Verrerbung nötig */
}
$abstchild = new AbstChild();
$abstchild->setName('AbstName');
echo $abstchild->toBeReplaced('gugus');
echo "
";
echo $abstchild->getName();
echo "
";
$withinterface = new WithInterface();
echo $withinterface->toBeReplaced();
echo "
";
$myme = new MyMe();
$myme->tellme();
$myme->listenme();
// $this->tagIds = array_map(fn (NewsTag $t) => $t->getId(), $news->getTags()->getArrayCopy());