I’m learning advanced level of OOP PHP..(Or I want to learn :))
This is my code.
Excerpt:
<?php
abstract class Karakter
{
abstract public function isim($name);
abstract public function yas($age);
public function yazdir()
{
print $this->isim() . " " . $this->yas();
}
}
class Insan extends Karakter
{
public $isim;
public $yas;
public function isim()
{
return "Bu adamın ismi: " . $this->isim;
}
public function yas()
{
return "Bu adamın yaşı: " . $this->yas;
}
}
When I run this code I can’t win through. I can see this error:
Fatal error: Declaration of Insan::isim() must be compatible with that of Karakter::isim() in C:\AppServ\www\OOP\1.php on line 26
You have defined the function
isimin the abstract class with one parameter.In order to correctly implement this function in any subclass you must override the function with exactly one parameter: