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!
Preview
To inherit ALL the abilities and attributes of another class, we use the keyword "extends ".
Key Concepts
- Use the Keyword extends
- You can only extend from one class at a time.
- A child class will "inherit" all the attributes and actions of a parent
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
In that folder is a listing
ListingBasic class.
0:00
This is the class we're going to extend.
0:02
So let's take a look at
what the class includes.
0:04
There are some private properties,
a constructor that sets those properties,
0:09
and the getters and setters for
each of those properties.
0:14
There's also a method named two array
0:16
that turns the object properties
into an associative array.
0:19
Let's create our new class
in the classes folder.
0:23
We'll name it ListingPremium.
0:28
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