Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Extending Object-Oriented PHP!
You have completed Extending Object-Oriented PHP!
In this video, we will create a second child while we look at more ways to override methods.
Siblings
We cannot call a private property of a parent directly. We have to make sure we call the parent getter when overriding a method in a child or we may hit an infinite loop.
public function getTitle()
{
return '<strike>' . parent::getTitle() . '</strike>';
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up