Questions tagged [interface]
An interface refers to the designated point of interaction with a component. Interfaces are applicable at both the hardware and software level. --- It also refers to the language-element `interface`, which is the sole exception to single-inheritance in Java, C# and similar languages.
interface
20,116 questions
2
votes
1
answer
103
views
Generic interface with default implementations
I have this interface:
public interface IDebugEndPoint
{
void InstructionReady(ICPU cpu);
}
where ICPU is implemented by ...
2
votes
1
answer
85
views
Instantiation of type with recursive type constraints
The Announcing F #7 page gives the example code
...
Advice
1
vote
0
replies
54
views
How do I create APIs for training ML models to play games? (Reference request)
I'm interested in learning how to train machine learning models to play video games. I would love to see general references (books and papers) on how to do this; I see lots of papers on the model ...
Best practices
1
vote
4
replies
143
views
What are the strengths and weaknesses of using VTable/COM-centric APIs?
I'm currently designing a library,
I want this library to maintain a stable interface for old applications,
However, it should be expandable.
It acts as a hardware abstraction layer.
The graphics ...
1
vote
1
answer
110
views
Best practices
0
votes
1
replies
65
views
How to constrain an interface to be only applicable for slices or maps
I've got a Matcher interface in Go that is implemented by quite a lot of underlying types.
I'd like to restrict the Matcher ...
0
votes
0
answers
88
views
How to register function delegate with interface that has a generic type?
I wanted to create a flexible MessageProcessor, depending on the SupplierType(= enum) and depending on which ...
1
vote
1
answer
76
views
2
votes
1
answer
76
views
Sorting the file structure list (Ctrl+F12)
Pressing Ctrl+F12 displays the file structure with a list of all fields and methods. Is it possible to change the sorting of this list so that the fields are displayed first and then the methods?
The ...
0
votes
1
answer
104
views
How to handle incompatible versions of PHP interfaces?
I have a PHP application which uses the \Psr\Log\LoggerInterface interface and classes that implement that interface. My application can be configured to authenticate users against a Joomla ...
1
vote
2
answers
1k
views
iOS 26. The problem with displaying the UISplitViewController
In iOS 26, the UISplitViewController primary or detail ViewController is displayed in modal mode, which is not correct. How to remove it?
Code for my UISplitViewController subclass:
...
1
vote
2
answers
100
views
golang interface matching different return types in generated code?
I have to deal with generated code - hence, it can not be changed.
...
-5
votes
2
answers
188
views
How to avoid heap allocation when calling interface methods on multiple struct types in a shared list [closed]
I'm writing a program that is very sensitive to garbage collection so I'm trying to avoid allocating to the heap after initialization.
In the example below, calling ...
0
votes
1
answer
63
views
Is there any way to make Groovy 4.0.x compile interfaces with static methods?
I want to make an interface with some static methods for decorating instances or adapting them to other interfaces. However, Groovy 4.0.x gives an error when trying to do this, probably because it's ...
1
vote
2
answers
208
views
Generic interface inheritance
I've tried looking up more specifics on this online but haven't found much info on this topic. I'm reading about generic interfaces from the C# documentation and everything seems reasonable until I ...
0
votes
0
answers
120
views
ARM Cross-Trigger Interface
I have a question regarding debugging on a multi-core board.
On my board, I have multiple cores, and for each core, I have created a CTI (ARM Cross-Trigger Interface). I am able to run and halt each ...
1
vote
4
answers
102
views
How to check for interface inheritance when looping through a list?
I have a Blazor server-side app where I use DynamicComponent on a page to create and add components at runtime. To do this I have the following:
A set of interfaces:...
1
vote
1
answer
51
views
Using Kotlin Generics in Nested Interfaces
I'm trying to write an interface for sending generic events to a remote server, along with a listener which returns a response that includes the list of events that was sent/attempted to be sent.
<...
1
vote
1
answer
95
views
Using generic interface for structs with pointer receivers that are passed by value in Go [duplicate]
I have a bunch of types that implements a Equal(other myType) method for comparison against other values of the same type.
These types are used as map values and I ...
1
vote
0
answers
73
views
Nominal typing with C++20 concepts [duplicate]
I'm trying to replace virtual base classes with concepts in a few places in my codebase where dynamic polymorphism isn't actually being used. However I still want it to be nominally typed. In ...
2
votes
3
answers
126
views
0
votes
0
answers
55
views
Docker running on OpenSUSE Leap 15.6
I am running Docker on my OpenSUSE Leap machine (in order to publish a web page in WordPress) which also serves as a firewall. How do I get my container to communicate on both the external interface ...
0
votes
0
answers
180
views
Directus custom button on the collection page extension
I'm trying to create a simple extension for Directus which adds a button at the header on collection list page (a button nearby "+" button)
When a user selects some of collection items, then ...
1
vote
2
answers
163
views
C# interface static method not always resolving correctly to derived class
The example below is contrived/simplified but displays the issue I am seeing.
Interface with a static method.
Base class that implements interface.
Two derived classes. One implicitly implements ...
0
votes
0
answers
84
views
TS2339: (TS) Property 'roundRect' does not exist on type 'CanvasRenderingContext2D'
I am writing a TypeScript application in Visual Studio. However, when I try to use the roundRect method associated with the Canvas 2D API, I get the compilation error:
TS2339: (TS) Property '...
4
votes
1
answer
150
views
Go GC doesn't collect dead weak pointers
I am trying to use weak pointers introduced in go1.24 to build a system in which weak pointers can be passed as interfaces. The problem is that weak.Pointer doesn't follow the same interface as the ...
-1
votes
1
answer
152
views
Understand reflection usage with structs and interfaces
I try to understand the correct usage of reflection with a struct compose by nested structs that implement an interface on Golang;
Here the code:
...
-2
votes
1
answer
85
views
Is IEnumerable.GetEnumerator() an acceptable name for an interface method implementation on the interface IEnumerable? [duplicate]
I stumbled across this definition:
...
0
votes
2
answers
99
views
Interface calculated getters [duplicate]
Just getting in to interfaces and I can't seem to find how to implement calculated fields... I know I can do this in the deriving class, but is there a way to do this in the interface itself?
A very ...
5
votes
2
answers
176
views
Simpler forwarding of contained object
I have a proprietary file format definition that contains a header format:
...
2
votes
1
answer
94
views
Java Stream API: Incompatible types: List<ArrayList>> cannot be converted to List<List>
My intention was to replace the following snippet:
...
1
vote
2
answers
143
views
How to properly implement instantiation of an abstract class based on parameters
I want to create a class that is called from other methods and change the implementation of that class based on some context (like params):
Abstract class:
...
0
votes
0
answers
50
views
How to define schemas for FastAPI when a image is involved [duplicate]
I know the concept of schemas and how we use it when designing FastAPI applications. For example
...
1
vote
2
answers
99
views
C++ template class as a member in a normal class
I'm creating GPIO abstraction driver for stm32. There should be a class with register accesses and another class that holds a reference to it. In that way the class holding a reference has no idea ...
1
vote
0
answers
86
views
Import interface/fuctions through WIT in JS Web Assembly Component Model WASM
I have a WIT compatible Web Assembly Component Model based module written in JAVASCRIPT/TYPESCRIPT and exposed as a WASM using jco and further transpiled to run in the browser. I have 2 questions in ...
0
votes
0
answers
55
views
Left sidebar database tree missing tables
I recently used phpmyadmin interface to duplicate a table from xxx_terms to aaa_terms. After doing this, the xxx_terms table disappeared from the db/table tree display on the left side of the window. ...
0
votes
1
answer
104
views
How to extend typescript interface with specific values enforced in an array property
I have a basic interface, which I use down the line to enforce specific values on other interfaces:
...
0
votes
0
answers
36
views
Call generic interface with generic argument without explict specifing both T [duplicate]
I need a way to store objects that have method with same return type, but different arguments types and call them without much extra code. My basic concept is:
...
-1
votes
2
answers
37
views
Mocking external package struct that depends on HTTP request
I'm working on a terminal game based on this card game that gets its cards from deckofcardsapi.com. Cards are stored in a struct named Card in a package called <...
-2
votes
1
answer
78
views
How to correctly extend an interface when using void
I have these TypeScript interfaces, and i want to extend HandleSendMessage with HandleMessage, but the void makes it a problem.
The project is in React.js with TypeScript and Vite, and it's part of ...
3
votes
0
answers
109
views
Wrong interface method called [duplicate]
Is the following a .NET 8 / C# bug?
...
0
votes
2
answers
91
views
Is there a way to get Java to recognize a higher order interface when a lower order is initialized? [duplicate]
I have one overarching interface then a bunch of different child interfaces
...
0
votes
3
answers
120
views
Generic method in non generic interface
Here is my interface.
...
4
votes
2
answers
291
views
Java example: Why can a function in this w3schools example run when it is not defined?
Here is the issue, you can find it in w3schools lamda expressions chapter last example:
interface StringFunction {
String run(String str);
}
And:
...
2
votes
3
answers
111
views
Why no compile error at CustomerService service = ServiceFactory.getInstance().getServiceType(ServiceType.CUSTOMER);
SuperService:
package service;
public interface SuperService {
}
CustomerService:
...
0
votes
0
answers
21
views
interface for model and general in ts
I am stuck in a situation please help.
I created a interface for User Model in mongoose and ts. the model has profile pic field which consists of a reference to document model. so my user schema model ...
1
vote
1
answer
88
views
How can I implement Interface for Node class
I'm trying to implement interface for Node class in CSharp.
NodeInterfaces.cs
...
1
vote
1
answer
64
views
Flutter/Dart- DAO interfaces- can't overload method parameters
Wanted to create an interface for DAOs that can be "overloaded" with different method params types:
...
1
vote
1
answer
77
views
Is there a language feature like Python's `issubclass` to cast instances of System.Type to the actual type (to access static methods w/o reflection)?
I have the following interface which contains a static method definition:
...
3
votes
3
answers
229
views
In C++, is there a way to provide object member name as template parameter?
I have multiple classes C1, C2, etc, each has different members variables, ex: C1M1, C1M2, C2N1, C2N2. And I have a pointer to data that could be an object of C1, C2 based on initial bytes.
Is there a ...