See all glossary termsBecause most programming is text-based, names are the main way we interact with external code. To use code written elsewhere, we need to know which keywords we can use, and how to use them.
At a high level, an interface is a contract that defines the ways in which an object can be used. When we say that an object implements an interface, it means we know in advance the methods and properties the object has, and how to use them. We don't need to know how the object works inside. This is the essence of Encapsulation.
GDScript doesn't have interfaces enforced by the language like Java or C#. Instead, GDScript uses duck typing: If an object has the methods and properties we expect, we can use it as if it implements an interface. This is a more flexible approach, but it also means we need to be more careful when using external code: since the engine doesn't check the interface for us, it is more error prone.See Also
Related terms in the Glossary
school.gdquest.com - 0.3.5-2024-12-12T18:17:18.104Z-a38dc74be3238fd1ea161f4df67b95520741da9d-release