If you have a class named "User" and another class named "Admin" that extends "User", and you want Admin to inherit all attributes,methods from User, except for the __construct method, for example.
class User {
private $name;
function __construct($name) {
$this->name = $name;
}
}
and
class Admin extends User {
private $authorization;
function __construct($name,$authorization) {
$this->name = $name;
$this->authorization = $authorization;
}
}
Is this correct? Does Admin override User's construct method? If the extending class has the same method name I suppose it's invalid. Am I totally missing the point of class extension?