C_WeaponFrag is the client side implementation of the class - you'll want to
either put your new function in the shared baseweapon code or in
C_BaseWeapon.

Ging

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wursteisen David
Sent: 10 August 2006 20:51
To: [email protected]
Subject: [hlcoders] virtual function

Hi,

This is for a noob question (I think :P)

I try to add a virtual function to CBaseCombatWeapon

So I add this into the declaration of this class :

virtual int GetHudDisplay() const {
        return Clip1();
}


and, in my weapon, which is derivated from class CWeaponFrag: public
CBaseHLCombatWeapon { public :
// something
int GetHudDiplay() const;
};

(CWeaponFrag -> CBaseHLCombatWeapon -> CBaseCombatWeapon )

When I debug this :
C_BaseCombatWeapon *weapon = player->GetActiveWeapon();
weapon->GetHudDisplay();

the debugger say that weapon is a C_WeaponFrag (so a CWeaponFrag, isn't it
?) but the weapon use the function from CBaseCombatWeapon and not
CWeaponFrag, as I want. but why ? There is something that I don't
understand...

thanks






_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to