-
Lunatic
[AS2] [Class Inheritance] Calling a subclass methode in the superclass???
Ok, im creating a shooting game and this is my problem:
I have a Gun class that is meant as a superclass for the Gun1, Gun2 and Gun3 classes. The Gun class contains all the basic properties and methodes, like rotation, that are all the same for each type of gun. A GunX class contains specific data for that type of gun and is extended from Gun. Makes sense doesn't it?
Anyway, because each gun triggers a different effect when shooting, I would like the shoot() methode to be in the GunX classes so I can specify each gun. But...
The event handlers are inside the Gun class, and from here I want to call the shoot() methode. But this isn't possible! It's not possible to call a methode of a subclass from the superclass.
What is the best sollution? Is there a way to make it possible anyway?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|