Problem with class that inherit from Sprite #1532
Replies: 3 comments 2 replies
-
What about your WEAPON IMPL ? |
Beta Was this translation helpful? Give feedback.
-
A Weapon *Bomb::createWeapon()
{
Weapon *weapon = static_cast<Weapon *>(Weapon::create("weapons/bomb/body.png")); <== incorrect logic
weapon->initializeData(); // <--- CRASH HERE
return weapon;
} A It looks like you forgot to implement the static method |
Beta Was this translation helpful? Give feedback.
-
Better: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Im with a problem that i don't understand what is wrong.
I have a class Weapon that inherit from Sprite:
WEAPON
BOMB
BOMB IMPL
WEAPON IMPL
But when i try create a
bomb
and call their methodinitializeData
it crash:It is not null and when i comment the line
weapon->initializeData();
it works without crash.What im doing wrong?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions