Posts

Showing posts from July, 2020

C# Interface

Image
Interface is like a class that contains only a definition of methods, events and properties. Interface is like a class that cannot be instantiated, interface define the abilities unlike a class that defines what an object is.  The purpose of an interface is to define a set of requirements that a class must implement. A class can inherit from multiple interfaces, and an interface can be implemented by many classes.   Interface members are automatically public, no access modifiers are allowed on interface members and they can also not be static. An interface cannot include an instance constructor because an interface cannot be instantiated. An interface cannot inherit from a class. An interface cannot contain fields and constants. An interface can be declared by attaching an interface keyword before the name of the interface and that is it, by convention I is used in naming an interface. interface IShapeComputer { string ShapeName { get; set; } ...