What is an Interface

后端 未结 4 912
醉梦人生
醉梦人生 2021-01-27 05:06

With reference to UML diagrams, what is an interface? and can someone explain in more simpler words. I cant understand anything from googling it.

相关标签:
4条回答
  • 2021-01-27 05:38

    An interface is like a template design for a class that contains no data or implemetnation; only definitions for methods, properties etc. These are abstract and cannot be instantiated but can be inherited from at which point all specified methods etc must be implemented by the concrete class inheriting the interface.

    0 讨论(0)
  • 2021-01-27 05:40

    An interface is a design item describing a behaviour. Classes implementing the interface will/must behave according to its definition. Interfaces are used to promote loose coupling and the base of many IoC patterns (Inversion of Control)

    0 讨论(0)
  • 2021-01-27 06:02

    In one word: it's a contract. Every class that implements this contract (interface) will have to implement the methods defined on it.

    0 讨论(0)
  • 2021-01-27 06:04

    A Interface is just a description of a class nothing concrete.

    You use it to create a new class "with the same description" without knowing the concrete implementation.

    0 讨论(0)
提交回复
热议问题