An interface can not contain constructors.
An interface only has the method signature.
An interface can not contain fields.
An interface can contain automatic property.
The modifier "Public" is not valid for methods
All methods and properties should be implemented in classes or structs that use the interface.
The interface's access modifier is internal by default. if we want to call it in other namespace, we need change it to public.
Create a new interface
Define the methods
Create an class to implement the methods defined by the interface. If we don't want to implement them, then the class must be abstract. In this case we will define a base class.
If we want to implement the methods define by the interface in a struct, we must make directly of the interface because the struct does not support inheritance.
Implementation the derived classes
Create a test method to test the struct
Run the struct
Create a test method to test the derived class using base class.
Create a test method to test derived class using the interface.
Test run



















No hay comentarios:
Publicar un comentario