Home  >  Article  >  Backend Development  >  How to declare member functions in C# interface?

How to declare member functions in C# interface?

WBOY
WBOYforward
2023-09-06 19:37:021036browse

How to declare member functions in C# interface?

Declaring the member functions of the interface in C# −

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

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

Above we see that our interface members are −

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

We will later in class Use it to implement the interface−

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

The above is the detailed content of How to declare member functions in C# interface?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete