Interfaces
An interface defines a contract of methods and properties that a class or object must implement, specifying what operations are available without dictating how they're implemented.
49 resources across 4 libraries
Glossary Terms(9)
Generics
Generics allow functions, classes, and interfaces to be written in terms of placeholder types that are specified when the code is actually used, enabling reusa…
Interfaces
An interface defines a contract of methods and properties that a class or object must implement, specifying what operations are available without dictating how…
Abstract Class
An abstract class is a class that cannot be instantiated directly and is designed to be subclassed, often providing shared implementation alongside one or more…
Polymorphism
Polymorphism is an object-oriented programming principle that allows objects of different classes to be treated through a common interface, with each object re…
Inheritance
Inheritance is an object-oriented programming mechanism that allows a class to acquire the properties and methods of another class, letting a subclass reuse an…
Encapsulation
Encapsulation is an object-oriented programming principle that bundles data and the methods that operate on it within a single unit (a class), while restrictin…
Dependency Injection
Dependency injection is a design pattern in which an object's dependencies are provided to it from the outside, typically by a framework or container, rather t…
Inversion of Control
Inversion of control (IoC) is a design principle in which the flow of control in a program is handed over to a framework or external system, rather than the ap…
Duck Typing
Duck typing is a style of dynamic typing in which an object's suitability for use is determined by the presence of the methods and properties it supports, rath…
Study Notes(17)
Service Contracts
How the ServiceContract and OperationContract attributes define the public interface of a WCF service, and the rules that govern them.
Interfaces and Generic Procedures
Learn how explicit interfaces make procedure calls safe and how generic interfaces let one name dispatch to multiple type-specific implementations, including o…
Interfaces and Abstract Contracts
Interfaces declare pure behavior for interoperability, while abstract contracts provide partial, shareable implementation — together they let you program to a…
Inheritance and Interfaces
Explore how VB.NET classes reuse and extend behavior through Inherits, Overridable/Overrides, and how Interfaces define implementation-free contracts.
Abstract Classes and Interfaces
Understand how Dart uses abstract classes to define partial blueprints and implicit interfaces via implements to enforce contracts without sharing code.
Interfaces and Unions
How GraphQL's two abstract types — interfaces with guaranteed shared fields, and unions with no shared contract — let a single field return polymorphic results.
Interfaces in Java
Learn how Java interfaces define a contract of behavior, support multiple inheritance of type, and how default/static methods work since Java 8.
Extending Interfaces in TypeScript
Learn how the `extends` keyword lets one interface inherit and build upon the members of one or more other interfaces.
Implementing Interfaces in TypeScript
Use the implements keyword to make a class satisfy an interface's compile-time contract, and understand how this differs from extending a base class.
Interfaces in TypeScript
Learn how TypeScript interfaces describe the shape of objects using structural typing, and why they are the primary tool for contract-based design.
Interfaces in Go
Learn how Go interfaces define behavior through implicit, structural typing without classes or inheritance.
Interfaces in Kotlin
Explore how Kotlin interfaces define abstract methods, default implementations, and properties that classes can implement.
Repository Pattern in Android
The repository pattern centralizes data access behind a single abstraction, hiding whether data comes from Room, Retrofit, or DataStore from ViewModels and the…
Enums in PHP
PHP 8.1 enums provide a first-class way to define a fixed set of named values, with optional scalar backing, methods, interfaces, and constants attached.
Inheritance and Interfaces
Understand how PHP classes extend one another via single inheritance and implement contracts via interfaces, including method overriding rules.
Collection Interfaces
Survey the layered hierarchy of IEnumerable, ICollection, IList, and their read-only and generic variants that unify how .NET collections are consumed.
Interfaces in C#
Understand interfaces as pure behavioral contracts that any type can implement, including default interface methods, explicit implementation, and multiple inte…
Cheat Sheets(2)
Interview Questions(21)
Difference Between Abstraction and Encapsulation
Abstraction hides complexity by exposing only the essential behavior of an object, while encapsulation hides an object’s internal data by bundling it with the…
Difference Between Interface and Abstract Class
An interface defines a contract of methods a class must implement with no state, while an abstract class can provide partial implementation and state and serve…
What is Abstraction in OOP?
Abstraction is the object-oriented principle of exposing only the essential features and behavior of an object while hiding the underlying implementation compl…
What is the Strategy Pattern?
The Strategy pattern defines a family of interchangeable algorithms, encapsulates each one behind a common interface, and lets the client swap the algorithm at…
What is Multiple Inheritance?
Multiple inheritance is when a class inherits fields and methods from more than one parent class simultaneously, combining their behavior into a single subclas…
What is the Open-Closed Principle?
The Open-Closed Principle (OCP) states that software entities — classes, modules, functions — should be open for extension but closed for modification, meaning…
Mixins vs Traits vs Interfaces: What is the Difference?
Interfaces declare a contract of method signatures with no implementation (in their classic form), mixins bundle reusable method implementations composed via i…
What is a Marker Interface in OOP?
A marker interface is an interface with no methods or fields at all, used purely to tag a class as belonging to a category so that other code can check for tha…
What is a Functional Interface in OOP?
A functional interface is an interface that declares exactly one abstract method, which makes it a valid target type for a lambda expression or a method refere…
What are Default Methods in Interfaces?
A default method is a method in a Java interface that provides a concrete implementation using the default keyword, allowing implementing classes to inherit re…
What are Static Methods in Interfaces?
A static method in an interface is a method with a full implementation that belongs to the interface itself, not to any implementing instance, and is invoked u…
How Does Java Avoid the Diamond Problem?
Java avoids the diamond problem for classes by permitting only single class inheritance — a class can extend exactly one superclass — while still allowing a cl…
What is a Pure Virtual Function?
A pure virtual function is a C++ member function declared with '= 0' that has no implementation in the class that declares it, forcing every concrete (non-abst…
What is an Abstract Method?
An abstract method is a method declared with a signature but no body, defined only inside an abstract class or interface, which every concrete subclass or impl…
Why Favor Composition Over Inheritance?
Composition is generally favored over inheritance because it produces looser coupling and more flexible designs: composed behavior can be swapped at runtime th…
What is a Listener Interface?
A listener interface is a contract, usually with one or a small number of methods, that a class implements so it can be registered with an event source and be…
What is a Protocol in Swift?
A Swift protocol is a blueprint of methods, properties, and other requirements that a class, struct, or enum can adopt and conform to, functioning like an inte…
Protocols vs Interfaces
Protocols and interfaces both define a contract of requirements a type must satisfy, but a protocol (as in Swift or Python) can typically be adopted by value t…
Structural Typing vs Nominal Typing
Structural typing determines type compatibility by comparing the actual shape of a type — its methods and properties — while nominal typing determines compatib…
What Are Generics in TypeScript and Why Use Them?
Generics let you write functions, interfaces, and classes that work with a type parameter decided at the call site, so you get full type safety without duplica…
What Are TypeScript Utility Types Like Partial and Pick?
Utility types are built-in generic type transformations, such as Partial, Pick, Omit, and Readonly, that derive a new type from an existing one instead of forc…