> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/classes/interfaces.md).

# Interfaces

Interfaces are a type of class that have a set of signatures for specific functions and it can even have some implemented functions. You can basically call an interface a signature map for the type of classes you want to create. In statically typed languages, they make a lot of sense since they can allow you to add/modify behavior of classes that the compiler can understand on how to link and compile. In a dynamic language, where functions can mutate or even be removed or injected at runtime, interfaces don't make soooo much sense. However, interfaces are a great way to provide documented signatures for developers to follow.

![](/files/sK4XfLFWazxNS4IPpo7e)

If you are developing frameworks, libraries or structured domain models where implementations can be done at a later point of time, or different strategies adapted; interfaces are king.

![](/files/GTVkTDExrxICcCAwjxzI)

## Declaration

Interfaces are defined in a file template with a `.bx` extension. For best practice you can start the name of the interface with a capital `I,` example: `IAnimal.bx, ILogger.bx, IAdapter.bx`

```java
interface extends="other_interfaces"{

    any function returnAny( required numeric obj, boolean why=false )
    function sayHello()

    ILogger function logEvent( required logEvent )

    // You can implement default behavior
    function getCacheKey(){
        return "default_key";
    }
}
```

## Implementation

Interfaces can extend other interfaces and classes that implement them can also implement many interfaces:

```java
class implements="ILogger,IAdapter"{
    any function returnAny( required numeric obj, boolean why=false ){
        // implementation here.
    }
    function sayHello(){
        return "Hola";
    }

    ILogger function logEvent( required logEvent ){
       // log this...
       return this;
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-language/classes/interfaces.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
