Questions tagged [implements]

`implements` is a keyword in several programming languages used to denote implementation of an interface.

implements is a keyword in several programming languages which support OOP (such as Java or PHP) used to denote interface implementation (as opposed to extends used to denote implementation inheritance).

Related

404 questions
2
votes
1 answer

Java: How to extend a object that uses generics but limit the type

I'm sorry but i'm not sure if i used or am using the correct terminology, but basically i want to create a class called EntityList that extends ArrayList but i want it so that the interface I created called EntityInterface is basically being used…
JayCD
  • 57
  • 8
2
votes
2 answers

Using abstract class that implements an interface (Java)

I have this interface, public interface IAnything { void m1(); void m3(); } And two abstract classes implementing this interface: public abstract class AbstractThing1 implements IAnything { public void m1() {} public void m3() {} } public…
user411103
2
votes
2 answers

Workaround interface implementing another interface

I'm trying to define some properties for objects in a game, so I use interfaces to specify them. I've created a Interactable interface, but then I want to create a Eatable interface, which obviously implements Interactable because the interaction is…
Hennio
  • 433
  • 2
  • 18
2
votes
1 answer

I want to add my own methods to a few Dart Classes

My attempt to simply 'Extend' the Map class fails because List is an interface and cannot be extended but must be implemented. The goal was simply to add a few methods on top of some existing class such as: List.add_unique(item) where I only want…
george koller
  • 3,721
  • 6
  • 23
  • 27
2
votes
4 answers

Java Implements interface

this is my attempt at implementing an interface. im getting the following error javac MyCollection.java ./au/edu/uow/Collection/DVDAlbum.java:6: cannot find symbol symbol: class Album public class DVDAlbum implements Album{ this is the super…
Daniel Del Core
  • 3,071
  • 13
  • 38
  • 52
1
vote
1 answer

Android: Different two uses of Renderer

I use two ways of Renderer to draw a triangle. One is work and one is none. Here is my two solutions. First Solution: cannot work when run. I emplements Renderer (You should see the line :glView.setRenderer method. That the basic difference of my…
hqt
  • 29,632
  • 51
  • 171
  • 250
1
vote
6 answers

First time implementing a java interface, can't get a successful compile

I need to implement a bag data structure using the interface java.util.Collection. I'm not asking for help on the actual implementation of the data structure. I just can't get my program to compile. I just want to get a blank implementation of the…
Alex
  • 51
  • 8
1
vote
1 answer

Implement method only if boolean is true (application:didReceiveRemoteNotification)

I'm trying to build my own library and I'd like to know if there is a way to only implement in my code a method if a certain boolean is true. It would be something similar to @available(iOS 14, *), but using a boolean declared in my class. The…
1
vote
4 answers

Why force generic parameter to implement an interface?

I'm working with WebAPI, my API needs to call an external API to get data back for processing. I designed a BaseResponse class as below: public interface IResponseData { } public class BaseResponse where T : IResponseData { public int…
1
vote
0 answers

typescript allows class to be more restrictive than implemented interface

Why does typescript allows MyClass to be more restrictive in the parameter type of someMethod than the interface it implements ? interface MyInterface { someMethod(n: number|Date):string } class MyClass implements MyInterface { someMethod( d:…
1
vote
1 answer

How to create a class implementing an interface with a nameless function in Typescript?

I am trying to mock a class implementing @azure/functions.Logger for unit tests in my Typescript app. The interface definition is export interface Logger { /** * Writes streaming function logs at the default trace level. */ …
Seth Kitchen
  • 1,526
  • 19
  • 53
1
vote
1 answer

Faked database is missing x properties, however those properties are private

I'm trying to write some tests for my code. I'm using dependancy injection, and I'm trying to create a faked version of my database to be used when running tests. I'm using the keyword implements to define my faked database, however I'm getting…
Wazbat
  • 53
  • 6
1
vote
1 answer

What's the difference between `MapBase` and `MapMixin` in terms of coding my own Map class?

I want to code my own Map class. MapBase and MapMixin have similar documentations. Which one should I use to code my own Map class? And why? I understand MapBase has more functions because it implements MapMixin. However, the functions in MapBase…
dmjy
  • 1,183
  • 3
  • 10
  • 26
1
vote
0 answers

TypeScript: Class incorrectly implements interface, mistmatched constructor

I have an interface like this: interface Foo { new (...args: any[]): any; } I want a class implementing Foo to have to have a constructor, but in my case, I don't need the constructor to have any specific arguments or return. I tried to implement…
Julian Lachniet
  • 223
  • 4
  • 25
1
vote
1 answer

Haskell TypeApplication-like way of explicitly picking an implementation of an interface

I'm using Idris 2 v0.3. I can't see why the compiler can't find an implementation for Gaussian of Distribution in interface Distribution dist where mean : dist -> Double data Gaussian : Type where MkGaussian : Double -> Gaussian Distribution…
joel
  • 6,359
  • 2
  • 30
  • 55