Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Lachezar Stamatov](https://secure.gravatar.com/avatar/159b095d64d8efa0ffeaca773d6bac7d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lachezar Stamatov
10,512 PointsExtending Object-Oriented PHP Challenge
Hi everyone,
I found this part of the course extremely confusing and wish the videos would just take more time to explain it in detail. Basically, I struggled to follow along and now cannot seem to pass this quiz. Could somebody walk me through the solution? It's very much appreciated!
P.S. Any additional tips that would help me grasp that part of the course are also welcome.
<?php
//do not modify this file
class User {
protected $name;
protected $title;
public function __construct($name = null, $title = null) {
$this->name = $name;
$this->title = $title;
}
public function __toString() {
return $this->getSalutation();
}
public function getSalutation() {
return $this->title . " " . $this->name;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function getTitle() {
return $this->title;
}
public function setTitle($title) {
$this->title = $title;
}
}
<?php
//do not modify this file
class Developer extends User
{
protected $skills;
public function getSkills() {
return $this->skills;
}
public function setSkills($array) {
$this->skills = $array;
}
public function displayUserSkills() {
return $this->getName() . ' has the following skills: ' . implode(", ", $this->skills);
}
}
<?php
//add code for Client class
?>
1 Answer
![Andrey Misikhin](https://secure.gravatar.com/avatar/dd738e1e73ca0facf91bc7b22c2727a9?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Andrey Misikhin
16,529 Points<?php
//add code for Client class
class Client extends User
{
protected $company;
public function getCompany() {
return $this->company;
}
public function setCompany($company) {
$this->company = $company;
}
}
Lachezar Stamatov
10,512 PointsLachezar Stamatov
10,512 PointsThank you, I actually figured it out on my own but I still think the videos could be a little more descriptive. I am still struggling with the logic behind these operations.