In previous article you have learned about Interface and Abstract class in C#.
Now you learn the difference between abstract class and interface in C#.
Here are some of the key differences between interface and abstract class in C#.
Here we define one abstract class with some properties and methods.
public abstract class CarBaseClass { public string Color { get; set; }abstract bool Start();//Abstract cannot be private public abstract bool Start();bool Stop();//either have body implementation or have abstract declaration bool Stop() { return true; } }
Things to notice in above abstract class declaration
(body)
Here is an example of how you can declare c# interface
public interface ICar { string Color { get; set; }public bool Start();//can't specify access modifier bool Start();void Stop() { }// can’t have implementation, only declaration void Stop(); }
Things to notice in above interface declaration
You should read following tutorials to understand differences between C# abstract class and interface.