+ 1
Is the reason behind the superclass is to reduce redundancy and memory?
What's the purpose of the superclass? It seems like you can create a program without it. I figure it's to reduce redundancy and memory.
2 odpowiedzi
+ 3
A super class allows the sub classes to handle all of its non-private properties. This is immensely USEFUL.
Here's a practical example, see if you can think of a way to do this without extending any classes.
Hint: Have fun hard-coding, having to manually create every individual class and set it's properties to tell what kind of object it is
https://code.sololearn.com/cZKcrU0TrMtX/?ref=app
(input a number to see output, from 2-4)
+ 1
I can see if you don't use inheritance in the program it would be very complex and huge - a lot of bugs.