Original Post
🔒 Locked
Pointer to an object
Advertisement
Is AssaultRifle a class or an object? CurrentGun is supposed to be a pointer to any weapon, right?
Gun* pCurrentGun = &AssaultRifle
pCurrentGun->Shoot();
Where AssultRifle's class inherits from Gun and Gun's Shoot method is virtual.
If that's not what you want, please clarify (What classes and objects do you have?).
Gun* pCurrentGun = &AssaultRifle
pCurrentGun->Shoot();
Where AssultRifle's class inherits from Gun and Gun's Shoot method is virtual.
If that's not what you want, please clarify (What classes and objects do you have?).
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement