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
7
votes
3 answers

Scala, can't implement generic java method

I'd like to implement a java method that uses generics in scala (2.9.2). But I'm failing... Java interface method: public void setAttribute(Key key, Number value); Scala code that want to implement that method: def…
GarfieldKlon
  • 11,170
  • 7
  • 31
  • 33
6
votes
2 answers

Why can't I implement multiple interfaces?

I am creating a game where objects implement interfaces for animations. I have a parent interface for the animations. Here is a shortened version: public interface Animates { S createAnimator(long animationTime); } In…
MWB
  • 1,830
  • 1
  • 17
  • 38
6
votes
4 answers

Why aren't new WPF Windows I create inheriting from Window?

When I create a new Window, using the Add Item... dialogue, the Window I create, e.g. NewWindow, does not inherit from Window. It only has the same interface as type Object. An example: I have the popup window code below. The code only sees the…
ProfK
  • 49,207
  • 121
  • 399
  • 775
6
votes
1 answer

Implement multiple interfaces with a single property in VB.NET

On startup, I load all my app.config values into a class named ConfigValues. My database only needs some of them so I have an IDatabaseConfig interface that specifies just the parameters that it needs. That way, when I'm creating a database…
KyleMit
  • 30,350
  • 66
  • 462
  • 664
6
votes
2 answers

How does a WCF proxy implement ICommunicationObject if it's methods aren't visible?

How does a WCF channel (created via ChannelFactory) implement ICommunicationObject, but doesn't expose the Close() method, for example, unless you cast the proxy to ICommunicationObject? Does that make sense? I got to thinking about that on the way…
Alex Dresko
  • 5,179
  • 3
  • 37
  • 57
5
votes
1 answer

Why Typescript allows implements abstract class?

I'd reading about typescript's class and abstract class and I did find something very interesting. Typescript allows us to implement classes. I even created a stackblitz project to test it. Anyway, I already found the general differences here, and…
Thomaz Capra
  • 985
  • 9
  • 21
5
votes
2 answers

Interface Limitations in VB6

I'm trying to implement (i.e. implement an interface) a class in VB 6, but I'm getting this error: "Compile Error: Bad interface for Implements: Interface contains data fields". So I'm wondering if there are any limitations on which class you can…
Perishable Dave
  • 2,858
  • 2
  • 24
  • 29
5
votes
2 answers

Cyclic inheritance and interfaces - class A can't implement class B interface while class B implements A interface

I have: public class A implements BListener { public interface AListener {} } public class B implements AListener { public interface BListener {} } So, if I understand correctly the cyclic inheritance happens because: The compiler goes to…
Not Gabriel
  • 531
  • 4
  • 13
5
votes
3 answers

java action listener: implements vs anonymous class

I am trying to teach myself Java and had a question that I wasn't able to answer so far. In some of my reading online I have found two ways of using action listener that seem to do the same thing. But I am trying to figure out what is the…
5
votes
2 answers

Member variable which must extend class A and implement some interface

I need to have a variable in a class which is an instance of class "ClassA" but which also implements interface "InterfaceI". Obviously this can be done for one or the other easily: private ClassA mVariable; private InterfaceI mVaraible; but how…
jtedit
  • 1,450
  • 2
  • 13
  • 27
5
votes
5 answers

Why are interfaces useful? (OOP)

I already know the fundamentals of the implements and interfaces. I don't understand when to use an interface. What is the requirement to have an interface? Example: /// Interface demo Interface IDemo { // Function prototype public void…
user840801
4
votes
1 answer

Understanding TS' type inferring/narrowing with combination of extends & implements

I have the following example code class B implements Error { name: string = ''; message: string = ''; // stack?: undefined | string; } function Foo(x: any) { if(x instanceof Error) { if(x instanceof B) { x.stack; // works } …
Juarrow
  • 2,232
  • 5
  • 42
  • 61
4
votes
1 answer

Class incorrectly implements interface 'OnChanges'. Property 'ngOnChanges' is missing in type

I basically started using angular 4 and and working with the ngChanges I'm getting this error Class 'GalleryComponent' incorrectly implements interface 'OnChanges'.Property 'ngOnChanges' is missing in type 'GalleryComponent'. I don't really…
Marcogomesr
  • 2,614
  • 3
  • 30
  • 41
4
votes
1 answer

Why are arguments renamed to RHS when implementing an Interface in VBA?

When you implement an Interface in your Class the arguments are automatically named RHS as shown on MDSN https://msdn.microsoft.com/en-us/library/office/gg264387.aspx For example, if I create IInterface as so: Public Property Let Value1(strValue1 As…
Jiminy Cricket
  • 1,377
  • 2
  • 15
  • 24
4
votes
2 answers

Trying to export to csv but how do i implement from delegate?

[new to swift] I testing this function to export some simple file @IBAction func exportFile(delegate: UIDocumentInteractionControllerDelegate) { print("export csv") let fileName =…
alex
  • 4,804
  • 14
  • 51
  • 86
1 2
3
26 27