interface Car{
year: number;
model: string;
electric: boolean;
}- An interface defines the structure (properties and methods) that a class or object should have, without defining how these methods are implemented.
- Interfaces help enforce consistency, encourage abstraction, and allow for polymorphism and better maintainability.
- They are widely used across programming languages like TypeScript, Java, and C# to ensure that objects or classes follow a specific contract or blueprint.