sorry i meant having two subclasses in the array.
So superclass is electronics
with a subclass of TV, and Computer
The array contains both TV's and Computers. So the array is of the electronics type.
Since it is of type electronics you can put both TV's and Computers inside of it. However you can't access the methods for TV or Computer. Just the Electronics methods.
Maybe it's just the book, but it made it sound that it was useful to have a bunch of different related subclass objects inside one array. So instead of having a separate array for each subclass there is just one big overreaching one. So say i had subclasses TV, Computer, Phone, Stereo. And I want to put all of them in one big array. Say it was all the electronics in my home and I wanted to perform something on all of them.
I have an array of type Electronics and it contains a bunch of different objects inside of it
in this situation would I use abstract methods for Electronics? It just seems like it would be useful to be able to group everything together into one array, but not at the expense of destroying functionality. I am just worried it could get messy if there are a ton of subclass types that have specific methods volumeUp, volumeDown, goToSleep, I wouldn't want to have a giant list of abstract methods in the Electronics class I don't think.
I guess it is mainly a lack of me knowing real world project structure. I can get it to work, but I like knowing the right way to get it to work.