Quick novice question: I want to extend a class as an array, like so
public class Map extends Item[][]
{
}
Is this possible, am I going about it the wrong way? Thanks!
Arrays are weird beasts. The have some properties, like length
but they are not a class, so you can't extend them like you are attempting.
I think you are better off using composition, i.e. create a class that contains an Item[][]
and then extend that class (if you need to, having one class might be enough)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With