0

What's the use/benifit of using Abstract classes?

Please in layman terms.

24th Oct 2022, 7:14 AM
Mozzie
Mozzie - avatar
2 Réponses
+ 1
for example, you want to create a game and your first idea is, your game need apples and peaches ... so first though is create a apple class and peach class ... But after a good sleep you think to yourself, I need more "fruits" for each level of my game .. but don't know what fruit yet and don't wanna think about it. That's when the abstract comes handy. You create an abstract class of fruits ... and you know everything that will extend from it will be a new type of fruit with the core-attributes you will define in the abstract ... that's one aspect of it in my opinion
24th Oct 2022, 2:51 PM
Will Motio
Will Motio - avatar
+ 1
The benefit of object oriented programming is difficult to explain with small scale designs. I would recommend to study OOP design patterns. Two main factors that contribute to the beneficial use of classes, polymorphism, and abstraction are the local design patterns and global architectural patterns that in the end structure your project. Both will introduce a heavy use of interfaces and abstract classes.
24th Oct 2022, 5:55 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar