Thread: C++ Questions
View Single Post
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-01-2016 , 18:42   Re: C++ Questions
Reply With Quote #11

Miu also said up above:
Quote:
When you want to reference an object that already exists rather than create a new one
meaning that code like the following, seen often in HLSDK:
PHP Code:
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); 
which just returns entity's private data (edict_t::pvPrivateData) which could be any class that derives from CBaseEntity (that's just how things work in GoldSrc). By doing that, you are not creating a new instance of CBaseEntity, you are just pointing to an existing one, allowing you to alter entity's private data.

I really can't think of any good examples right now, sorry about that, hope these explanations are good enough to make you understand the concept a little bit better.

Last edited by klippy; 01-01-2016 at 18:43.
klippy is offline