Skupaj Skupaj - 1 year ago 78
C# Question

Making interface from class

I'm having some troubles making an interface for my class. I tried with a simple public void and that worked. But i cannot get it to work with the public static voids in the code below. I think it has something to do with the enum as a parameter in the method. But How do i fix this?

This is the class:

enter image description here

And this is my interface:

enter image description here

Answer Source

Interfaces are contracts. They specify the method signatures for all methods within the contract.

In your interface, you have:

void FFT(/*stuff*/)

Yet, in your implementation, you have defined

static void FFT(/*stuff*/)

Now, why can't we use static? From Joel Spoelsky

Because an interface is a "contract" or an agreement between the consumer (caller) and the provider (callee). An interface describes what and how the calle will provide functionality. There is no need for static members provided by a third party. Static members cannot be overridden by a provider so they do not belong in an interface.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download