+ 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.

2nd Jun 2017, 6:11 PM
Jack Shearer
Jack Shearer - avatar
2 Réponses
+ 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)
2nd Jun 2017, 6:28 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
I can see if you don't use inheritance in the program it would be very complex and huge - a lot of bugs.
2nd Jun 2017, 6:43 PM
Jack Shearer
Jack Shearer - avatar