Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 530 Bytes

File metadata and controls

15 lines (11 loc) · 530 Bytes

Interface

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.