Click here to Skip to main content
15,921,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone i am new to C# plz help me understand
what interfaces are,how they are used and what are interface references.
Posted

Interfaces describe a group of related functionalities that can belong to any class or struct.

You define an interface by using the interface keyword

Interfaces consist of methods, properties, events, indexers, or any combination of those four member types.

An interface cannot contain constants, fields, operators, instance constructors, destructors, or types. It cannot contain static members.

Interfaces members are automatically public, and they cannot include any access modifiers.

Read detailed description on MSDN:
Interfaces (C# Programming Guide)[^]

..and more details here[^]

The C# Station Tutorial[^]
Similar QA: why use interfaces?[^]
 
Share this answer
 
v2
See also "Interfaces in C# (For Beginners)"[^] here at CodeProject.
 
Share this answer
 
As you know multiple inheritance is not allowed means one child can not have two parents logic becomes ambigous.
yes but u want to have different fuctionality you can provide interface.
for example:

Samsung tablet what u called it as computer,mobile,web camera,or music system its have all the features of mobile,computer,webcamera so i can say i can provide tablet class inteface of mobile,computer,webcamera.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900