Home > Backend Development > C#.Net Tutorial > How to declare member functions in C# interface?

How to declare member functions in C# interface?

WBOY
Release: 2023-09-06 19:37:02
forward
1078 people have browsed it

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
   }
}
Copy after login

Above we see that our interface members are −

void InterfaceMemberOne();
double InterfaceMembeTwo();
void InterfaceMemberThree()
Copy after login

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

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template