From 32668a3b5aaca2e84861d1dad0908d9b2506430b Mon Sep 17 00:00:00 2001 From: Bart Duisters <43420049+bartduisters@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:16:00 +0100 Subject: [PATCH] Update 17_oop.php employee -> Employee Add an access modifier to the $title property (either this, or explicitly define the $title property as part of the class without a modifier), otherwise --- 17_oop.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/17_oop.php b/17_oop.php index bfd5295..768fd49 100644 --- a/17_oop.php +++ b/17_oop.php @@ -61,8 +61,8 @@ function __destruct() { It is achieved by creating a new class that extends an existing class. */ -class employee extends User { - public function __construct($name, $email, $password, $title) { +class Employee extends User { + public function __construct($name, $email, $password, private $title) { parent::__construct($name, $email, $password); $this->title = $title; } @@ -72,5 +72,5 @@ public function getTitle() { } } -$employee1 = new employee('John','johndoe@gmail.com','123456','Manager'); -echo $employee1->getTitle(); \ No newline at end of file +$employee1 = new Employee('John','johndoe@gmail.com','123456','Manager'); +echo $employee1->getTitle();