Challenge: Abstract Classes and Methods
Explore how to define abstract classes and methods in PHP. Learn to create a User class with abstract methods, implement inheritance with Admin and Viewer classes, and practice encapsulation using protected properties and public getters and setters.
We'll cover the following...
We'll cover the following...
Task
- Create an abstract class named
Userwith an abstract method namedstateYourRole(). - Add a
protectedproperty named$usernameto theUserabstract class.