I'm trying to learn Java. Now I have a little question.
I have set up a very primitive Inventory-system tied to a "Character"-object that I made myself and there are a couple of methods to check the various attributes of the items. All this works.
However, I encounter problems when I wanted to have an additional Item-type, called Weapon.
My initial idea was to create a new Weapon-class which inherited everything from the Item-class. I added some extra methods and attributes for damage and weapon usage here.
Now the problem appears after I have added my Weapon-object into the inventory (an ArrayList of the "Item"-type).
I want to print some text which displays the various properties of the item. Doing this to normal items is no problem, but it doesn't work for Weapons because of the methods added to the Weapon class that are not found inside the Item class.
I don't need any code. I just want someone to explain to me roughly how to achieve something like this. Maybe I'm doing it completely wrong. If so, I want to be directed towards the proper way