C# Interface

We have two Classes ClassOne & ClassTwo and two interfaces InterfaceOne and InterfaceTwo.
Is this code valid?
interface InterfaceOne

{
void InterfaceOneMethod();
}

interface InterfaceTwo
{
void InterfaceTwoMethod();
}

class ClassOne : InterfaceOne, ClassTwo
{
public void InterfaceOneMethod()
{
//Some Code
}
}

class ClassTwo
{
}

Ans: Base class must come before interface.

class ClassOne :   ClassTwo, InterfaceOne

{
public void InterfaceOneMethod()
{
//Some Code
}
}

0 comments:

Post a Comment