Thanks for your efforts! I have subscribed to your channel. Would you recommend using Interface over the abstract class or the other way around? I mean I find it hard to know exactly the essential difference between them. 1- I know that a class has the freedom to how the methods will be implemented when using interface. However when using abstract class, the methods must be used as they were defined in the parent class. The interface only tells a class which methods should be implemented without specifying the way to implement them. The abstract class has a more direct purpose of telling its sub-classes how the method should be implemented. 2- A class can only extend an abstract class, while it can implement multiple methods. 3- An abstract class generalize methods, I mean that the sub-classes are related. Whilst an interface is used when the classes are not related. The real question is: When to use what? I also have a request, could you please talk about the differences between static and instance methods?
It’s fine not seeing clearly the difference between the two, because they are similar. My take is that you should avoid using abstract class as much as possible. There are techniques that help you accomplish the same without them (see composition over inheritance). Thanks for subscribing and commenting!