How to declare member function in C# interface?

CsharpProgrammingServer Side Programming

To declare member functions in interfaces in C# −

public interface InterfaceName {
   // interface members
   void InterfaceMemberOne();
   double InterfaceMembeTwo();
   void InterfaceMemberThree()
}

public class ClassName: InterfaceName {
   void InterfaceMemberOne() {
      // interface member
   }
}

Above we saw our interface members are −

void InterfaceMemberOne();
double InterfaceMembeTwo();
void InterfaceMemberThree()

We have then used it in the class for implementing interface −

public class ClassName: InterfaceName {
   void InterfaceMemberOne() {
      // interface member
   }
}
raja
Published on 06-Aug-2018 12:03:40
Advertisements