Interviews - C# Corner

Ahsan Siddique
how would i know if a class is an interface or simple class?
By Ahsan Siddique in .NET onNov 26 2017
  • Bikram Limbu
    Mar, 2018 14

    An interface provides a contract specifying how to talk to an object, but not the specifics of how that object handles that request (apart from parameters and return types etc)A class provides both the information on how to talk to an object, but in some cases the actual implementation (think overriding a method of a base class).

    • 1
  • dibyanka
    Sep, 2018 25

    The declaration of an Interface is as follows Public interface IinterfaceName { //interface members void DoCalculations(); }If you observe the keyword "interface" and the name of the interface starts with "I" . it is an interface. Also the interface members only contains contracts, no definitions while in a regular class, there will be the keyword "class" and doesn't have any specific letter to start with the class name. So, just to identify visually this much should be enough. For the difference between class and an Interface you will find many on google. Hope this helps.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS