Interface is used to implement more than one class but it doesn't have any code inside its methods... however the method that is called works with its respective function. Also, it gets very confusing when it is used in design patterns like facade. example: in case of PHP framework Laravel.
-
3Possible duplicate of What are the differences between abstract classes, interfaces, and when to use themgnat– gnat2017年02月13日 13:11:47 +00:00Commented Feb 13, 2017 at 13:11
1 Answer 1
"Interface is used to implement". This is at best misleading and at worst just flat wrong. The whole point of interfaces is to abstract away the implementation. An interface works by providing a "contract" or agreement of sorts between the the client and the underlying implementation, as to what is available to be called, parameters required etc
In that way, the client and the implementation are not so tightly coupled together and are easier to change out.