0

there is register() method in Service Provider which is used for bind the classes but i don't know what boot() method's do ? can you please explain it.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
vishal ribdiya
  • 1,013
  • 2
  • 12
  • 20

2 Answers2

2

Interfaces by themselves are not very useful. But when implemented by concrete classes you see that it gives you the flexibility to have one or more implementations.

The bonus is that the object using the interface do not need to know how the details of the actual implementation go - that's called encapsulation...

Also It's difficult for me to imagine clean, object-oriented code without the use of interfaces. You use them whenever you wish to enforce the availability of certain functionality without forcing classes to inherit from a specific base class, and this allows your code to have the relevant level of (low) coupling.

iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
0

What i can tell you is that Interfaces can be used in such situations where you want users to mandate to use defined methods in every inherited class. Such as when you define user login check method in your interface you can inherit to classes which are required to use this method to perform this method.

One noticeable problem with Interfaces is that once if you add a new method to your Interface it effects all its child classes as they might not have declared the new method in them. So it breaks and throws an error.

user7325973
  • 182
  • 3
  • 17