Тёмный

Abstract Classes vs. Interfaces? What is the difference? Java Object-oriented programming tutorial! 

Programming with Mati
Подписаться 3,1 тыс.
Просмотров 726
50% 1

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 4   
@ghanshyamkhatri3541
@ghanshyamkhatri3541 Год назад
Very Nice explaination!!
@programmingwithmati
@programmingwithmati Год назад
Thanks for the comment!
@MISA-qy4hx
@MISA-qy4hx Год назад
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?
@programmingwithmati
@programmingwithmati Год назад
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!
Далее
aespa 에스파 'Whiplash' MV
03:11
Просмотров 17 млн
Меня знают уже все соседи😅
00:34
07 Eventos click e input
8:54
Просмотров 5
Abstract Classes vs Interfaces (Java)
9:43
Просмотров 208 тыс.
Object-Oriented Programming is Bad
44:35
Просмотров 2,3 млн