Questions tagged [interface-implementation]

137 questions
3
votes
3 answers

Overriding equals in C# interface implementation

I have a class that implements an interface, such as this: interface IInterface { string PropA { get; } string PropB { get; } } class AClass : IInterface { string PropA { get; protected set; } string PropB { get; protected set;…
Dave
  • 305
  • 2
  • 4
  • 8
3
votes
4 answers

Inner classes inside Interface

Can we have a class inside an interface which has different methods of the interface implemented in it. I have a doubt here that why Java allows writing Inner classes inside interfaces and where can we use it. In the program below I have written a…
Niketh Kumar
  • 159
  • 1
  • 2
  • 8
3
votes
1 answer

how to implement a static method in a class that implements an interface?

I'm implementing a java class that implements an interface. The poi is that, a method in this class must be static, but in the interface I can't (as known) declare a method as static, and if I try to declare it in the class, I get this error: "This…
idell
  • 107
  • 1
  • 2
  • 13
3
votes
3 answers

C# inherited protected method implementing interface

I have this class/interface definitions in C# public class FooBase { ... protected bool Bar() { ... } ... } public interface IBar { bool Bar(); } Now I want to create a class Foo1 derived from FooBase implementing IBar: public…
devio
  • 36,858
  • 7
  • 80
  • 143
3
votes
1 answer

"Go To Definition" equivilent shortcut for interface implementations?

Possible Duplicate: How do you quickly find the implementation(s) of an interface's method? Go to definition on concrete type Coding to interfaces is great until you want to quickly jump to a function implementation. In the good ole days, F12 (Go…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
2
votes
1 answer

Does DataTable implement IListSource?

The documentation (and intellisense) states very clearly that DataTable implements IListSource. But then why doesn't DataTable have a getList() method, which is (the main) part of the IListView interface?
Baruch
  • 20,590
  • 28
  • 126
  • 201
2
votes
3 answers

Java implementing business logic based on EnumType given as field of Object

I know my question title is not relevant to what I'm asking, but not getting any better title. But feel free to suggest title. (So it will be helpful for others as well) Here is the scenario I'm having: I've enum class as below public enum…
AshwinK
  • 1,039
  • 1
  • 12
  • 31
2
votes
2 answers

C# Diamond-Inheritance (Interface Implementation)

If a class implements an interface from two separate interfaces, does it behave exactly as if it implements it only once? Example: public interface IAnimal { /* ... */ } public interface IFullAnimal : IAnimal { /* ... */ } public interface IBear :…
2
votes
1 answer

DOM interfaces: inheritance vs. implementation

On multiple places of MDN like here there are quotes like Inherits properties from its parent, Node, and implements the ChildNode interface. What is the difference between inherits and implements here? I am confused from interface implementing…
Jan Turoň
  • 31,451
  • 23
  • 125
  • 169
2
votes
0 answers

Auto generate implementation class for Interface in Java

I've used Spring Data Repository for basic CRUD operations on multiple data stores(relational databases, mongodb and elasticsearch). As per my understanding, it doesn't require the user to provide an implementation of the Repository and it works…
user6077173
2
votes
2 answers

Error: List does not have the matching of 'System.Collections.Generic.IEnumerable

How to implement interface members "f" with the list? public interface I { IEnumerable f { get; set; } } public class C:I { public List f { get; set; } } Error 1 'ClassLibrary1.C' does not implement interface member…
SkyN
  • 1,417
  • 4
  • 17
  • 32
2
votes
1 answer

Remove Interface Members from Implementation when Interface Changes

Situation: I implement an interface implicit and remove a property on the interface (later). There is no warning that this property should be removed on the implementation class. I know I could implement the interface explicitly, but I would try to…
joerg
  • 717
  • 2
  • 8
  • 18
2
votes
2 answers

How do I pass an ArrayList to method that takes a collection as an input

I want to pass some ArrayList X into method a(Collection someCol) that takes Collection as an input. How can I do this? I thought an ArrayList was a Collection and thus I should be able to "just do it" but it seems that…
Ankur
  • 50,282
  • 110
  • 242
  • 312
2
votes
4 answers

invoking method declaration without reflection

I have a base class (order) with a set of sub classes (productorder, specialorder, partsorder etc). Only Some of these sub classes implement a particular interface (ITrackingCustomer) which has a single method declaration (object getcustdetails()).…
2
votes
2 answers

Implementing a generic factory

I am trying to design a factory for a pluggable interface. The idea is that once you have your factory instance, the factory will return the appropriate subclasses for that particular implementation. In this case, I am wrapping a third party library…
durron597
  • 31,968
  • 17
  • 99
  • 158