Hello, I'm new to programming and am currently exploring the world of OOP.
However I've come across a problem, I've got a superclass called Object, all of the game objects will extend this Class.
In the Object class, I've got a few variables and methods wich are working fine.
So I create a player object:
Object player = new Player(100, 100); //100, 100 are the x & y variables
In the Player class I've got an method that is not in the superclass (Object.java).
When I try to call this method (from another class in the same package) it cannot find the method. It can find all the methods in the superclass, and if I add it to the superclass and then override it in the subclass it works as it should work.
However I find this very 'clumsy'.
So to put my question in one sentence:
"How can I call a method from a subclass that is not in the superclass?"
I hope that somebody can explain it, or point me in the right direction.
Thanks in advance,