In PHP OOP, a class implements an interface using the implements keyword like class ClassName implements ______.

  • InterfaceName
  • ClassName
  • TraitName
  • AbstractClassName
In PHP OOP, a class implements an interface using the implements keyword followed by the name of the interface or a comma-separated list of interface names. For example: class ClassName implements InterfaceName { } By implementing an interface, a class agrees to fulfill the contract defined by the interface. The class must provide an implementation for all the methods defined in the interface. A class can implement multiple interfaces by listing them after the implements keyword, separated by commas. This allows the class to define behavior and functionality according to multiple contracts. To know more about interface implementation, visit: http://php.net/manual/en/language.oop5.interfaces.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *