user478636
user478636

Reputation: 3424

What is an Interface

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

Upvotes: 0

Views: 1142

Answers (4)

stack man
stack man

Reputation: 2413

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

Upvotes: 1

Chris Snowden
Chris Snowden

Reputation: 5002

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.

Upvotes: 3

jdehaan
jdehaan

Reputation: 19928

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)

Upvotes: 2

sra
sra

Reputation: 23975

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.

Upvotes: 1

Related Questions