Skip to content

Interface

SimonePortanova edited this page Mar 18, 2024 · 2 revisions

Usage

An interface is an abstract class that is used to group related methods with empty bodies. To "inherit" an interface you have to use the implements keyword, just like you would do with a normal class, but with different words.

NOTE

You cannot create an object of an interface, just like abstract classes. The methods in the interface do not have any body. The body is provided by the class that implements the interface. A class cannot inherit two super-classes, but it can implement as many interfaces as needed.

Link to W3 page on interfaces

Clone this wiki locally