From the course: PHP: Object-Oriented Programming

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Challenge: Access control

Challenge: Access control - PHP Tutorial

From the course: PHP: Object-Oriented Programming

Challenge: Access control

(techno music) - [Instructor] It's time for another challenge assignment. This time, the challenge is to make sure that you understand access control and how to use visibility modifiers inside your objects. There are four parts to this challenge. The first is that we want to add visibility modifiers to our Bicycle class. That's the class that we created in Challenge 01. So, the very first thing you want to do is create a new file called Challenge_03, then you want to go to that Challenge 01 file and copy the class definition for Bicycle into it. So we can start with that. It's a starting point, then you're going to set visibility for all of the existing properties and methods. You'll need to consider which of the attributes and methods need to be public, and can any of them be made private? And if they do need to be made private, do subclasses still need access to them? That'll be part one of the challenge. The second…

Contents