#70 BC EXTEND AL INTERFACES
An interface is a syntactical contract that specifies the functionalities a certain object must have, while enabling multiple implementations as long as they comply with the defined interface. Thus, from BC25, Microsoft allows the extension of Interfaces, giving developers the chance of introducing new functionalities without modifying the core solution.
Extensible interfaces provide substantial business value by facilitating the development of flexible and adaptable extensions that can evolve with changing business requirements, saving time, reducing costs and minimizing the risk of errors in the existing code.
In the declaration of an interface, you can extend one or more interfaces. The new interface will inherit all the methods of the interfaces it extends. This way, both the methods from the extended interfaces as the ones from the new interface must be addressed when implementing an interface that extends others.
Example
As shown in the picture above, an interface (IFooBar) can extend multiple preexisting interfaces (IFoo and IBar). Thus, when implementing the new IFooBar interface, the methods defined in IFoo, IBar and IFooBar must all be implemented to comply with the interface contract.
Other interesting links:
- What’s new and planned for Dynamics 365 Business Central
- Extend AL Interfaces
- Extending AL Intefaces
- ArquiTips 123 BC Taking the most out of Interfaces
- ArquiTips – Knowledge Center