Search⌘ K
AI Features

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...

Task

  • Create an abstract class named User with an abstract method named stateYourRole().
  • Add a protected property named $username to the User abstract class.
...