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

# Interfaces

Interfaces are a type of component that have a set of signatures for specific functions and in some of the latest versions of Lucee and Adobe ColdFusion it can even have some implemented functions.  You can basically call an interface a signature map for the type of components 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.

![](https://1963028932-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LA-UVvdhvPQ4iTxu_CD%2F-Llb4dF663f83euBMP_-%2F-Lld64SOtd84odKmPPVg%2Finterfaces-vs-abstract-classes-1.png?alt=media\&token=e3ae8479-46c6-40e1-aca1-545fc6d20f08)

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.

![](https://1963028932-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LA-UVvdhvPQ4iTxu_CD%2F-Llb4dF663f83euBMP_-%2F-Lld6LFvsOF-8E6LZBmd%2F6a00e5501e33db8834016302f63fc2970d-500wi.png?alt=media\&token=c4e6cfda-3acb-4a3d-bd98-21da0ae82a06)

## Declaration

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

```java
interface extends="other_interfaces"{

    any function returnAny( required numeric obj, boolean why=false )
    function sayHello()
    
    ILogger function logEvent( required logEvent )
    
    // If in Adobe2018 or Lucee, you can implement default behavior
    function getCacheKey(){
        return "default_key";
    }
}
```

## Implementation

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

```java
component 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://modern-cfml.ortusbooks.com/cfml-language/components/interfaces.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
