Member 9233080 asked:Hello Sergey, could you explain the difference between abstract class and interface with real world example? Thanks in advance.
Well, the question about "difference" is not quite correct. Could you possibly define what is "difference"? (What is the difference between apple and Apple?
Nevertheless, considering the use of abstract classes vs interfaces is important, because in real life, the decision of using interfaces can be considered as the alternative to using abstract classes, or both approaches could be combined. Making the decision is not trivial and not easy. And it's not so easy to explain in brief; even though many tried to explain it simply, such explanations rarely reflected the essence of things and they rarely provided valid practical criteria for good code design.
Let me try. Please see these past discussions, including my answers:
When we use abstract and when we use interface...?
Difference between abstract class and interface if they have same no of methods and var
How to decide to choose Abstract class or an Interface
Interfaces and Polymorphism
As to the examples, the short examples of the usage are easy to write, but they can only show the syntax, which you can easily find out by yourself, but a short examples will hardly help to make a right choice. Maybe you will better ask you follow-up questions if you need.