There's some way to initialize the properties of an abstract class in php like this example in java?
public abstract class Person
{
private String name;
public Person(String name)
{
this.name = name;
}
}
public class Client extends Person
{
public Client(String name)
{
super(name);
}
}
Here's my actual code : I'm getting this error : "Variable $name seems to be uninitialized"
abstract class Person
{
private $name;
public function Person($name)
{
$this->$name = $name;
}
}
class Client extends Person
{
private $name;
public function Client($name)
{
parent::Person($name);
}
}
__construct()for your constructors in PHP classes, not the name of the class.... the latter was retained for backward compatibility with PHP 4, but is now deprecated