1.

What Is Interface In Php?

Answer»
  • Interfaces are defined USING the interface keyword.
  • All methods declared in an interface MUST be public. Classes defined as Interface may not be instantiated(create object).
  • To EXTEND the interface class, IMPLEMENTS OPERATOR is used.
  • You can inherit number of interface class at the time of extending and number of abstract class separated by comma.
  • All methods in the interface must be implemented within a child class; failure to do so will result in a fatal error.
  • Interfaces can be extended like classes using the extends operator.
  • The class implementing the interface must use the exact same method signatures as are defined in the interface. Not doing so will result in a fatal error.
  • Type hint & number of parameter must be match.



Discussion

No Comment Found