What is the difference between an interface and a class, and why I should use an interface when I can implement the methods directly in the class?
Interfaces are excellent when you want to create something like it: using System; namespace MyInterfaceExample { public interface IMyLogInterface { //I want to have a specific method that I’ll use in MyLogClass void WriteLog(); } public class MyClass : IMyLogInterface { public void WriteLog() { Console.Write(“MyClass was Logged”); } } public class MyOtherClass : IMyLogInterface … Read more