Questions tagged [interface-implementation]
137 questions
10
votes
8 answers
Find unimplemented class methods
In my application, I'm dealing with a larger-size classes (over 50 methods) each of which is reasonably complex. I'm not worried about the complexity as they are still straight forward in terms of isolating pieces of functionality into smaller…

Aleks G
- 56,435
- 29
- 168
- 265
9
votes
2 answers
What is the difference between "extends" and "implements" in java with respect to performance and memory,etc
What is the difference between extends and implements in java with respect to performance and memory,etc.
For example take the following scenarios,
1)
public interface PrintResult
{
public final int NO_ERROR=0;
public final int SUCCESS=1;
…

SIVAKUMAR.J
- 4,258
- 9
- 45
- 80
9
votes
3 answers
Interface/Implementation in ANSI C
I'm working on a large project in C, and I want to organize it using interface (.h) and implementation (.c) files, similar to many object-oriented languages such as Objective-C or Java. I am familiar with creating static libraries in C, but I think…

user2105505
- 686
- 1
- 9
- 18
8
votes
3 answers
Java interfaces - What exactly is in the contract?
I know and understand the value of interfaces in Java. You code to the interface, and then you can change your implementations without having to change any code using the interface. Often the term "contract" is used in connection with interfaces.…

dnc253
- 39,967
- 41
- 141
- 157
7
votes
2 answers
Error that I must implement a function in a class even though function is defined
I get the error: Class 'QueryParameterComparer' must implement 'Function Compare(x As QueryParameter, y As QueryParameter) As Integer' for interface 'System.Collections.Generic.IComparer(Of QueryParameter)'.
On this class definition:
Protected…

Adam
- 6,041
- 36
- 120
- 208
6
votes
2 answers
How to auto-generate methods of the implemented interface
Is there a way in PhpStorm to automatically generate the empty methods that are required by the interface the given class is implementing?
Say we have an Interface with 3 methods - when defining the new class that implements this interface - some…

Sebastian Sulinski
- 5,815
- 7
- 39
- 61
6
votes
1 answer
base class implementing base interface while derived/concrete class implementing extended interface, why?
I am following a book namely ".NET Domain Driven Design with C#".
Question is based on scenario as shown in Class Diagram below:
Figure:
http://screencast.com/t/a9UULJVW0
In this diagram,
A) IRepository interface is implemented by (abstract base…

Fakhar Anwar
- 295
- 1
- 3
- 20
6
votes
4 answers
XmlResourceParser implementation
I need to dynamically load a xml layout from the server. LayoutInflater has inflate methods that use a XmlPullParser. I've tried that, but it doesn't work.
Looking into the Android source code, it turns out those inflate methods are called with a…

Mugur
- 1,019
- 9
- 21
6
votes
2 answers
Stack implements ICollection, but has methods from ICollection
I'm trying to create a custom collection based on Stack. When I look at Stack [from metadata] in visual studio, it shows that Stack implements ICollection, which would require it to implement ICollection's CopyTo(Array array, index)…

Thick_propheT
- 1,003
- 2
- 10
- 29
5
votes
2 answers
C# interface implementation with an interface property
I am starting to dive a bit further into C# programming and have been messing around with interfaces.
I understand the basics of an interface in that they are supposed to be "contracts" for any class that implements them. Whatever is defined in the…

George Pippos
- 81
- 1
- 1
- 5
5
votes
2 answers
Whether to extend interface, when base class already extends same interface
In C#, as shown in the code snippet below, is it correct/proper to extend the interface IFoo when declaring the class A, knowing that the class BaseClass extends the interface IFoo? Is it necessary to specify the interface IFoo here, and is it best…

Osama
- 456
- 4
- 15
5
votes
3 answers
what is the purpose of implementing OnInit class, removing ngOnInit works fine?
In angular 6 when we create a component the the .ts file of that component has a class which implements the OnInit class but when we remove the default method(ngOnInit), it works fine.
so my question is if it implements some class then it must had…

amit
- 53
- 1
- 1
- 11
5
votes
0 answers
Understanding this C++ code. Inheritance and scope changes
I came across this in one of the posts on SO.
I am having difficulty understanding the following code.
class A
{
public:
virtual void foo() = 0;
private:
virtual void bar() = 0;
};
class B : public A
{
private:
virtual void foo()
…

Rajeshwar
- 11,179
- 26
- 86
- 158
4
votes
1 answer
Restrict the return value of an interface to a range in implementing classes
I am writing a small library where I have some interface providing a method where the return value should be in a specified range. How can I explicitly forbid users of my library who implement this method to return a value not in this…

spettekaka
- 411
- 3
- 11
4
votes
4 answers
How to automatically bind implementations in PHP?
So I am a laravel developer and even though I have worked with it for a while now, and I love how the magic happens beneath the surface, how it automatically binds implementations when instantiating classes via the IoC container, right now I am…

Rohan
- 13,308
- 21
- 81
- 154