[Kde-games-devel] Re: Kplayer and game logic

Kleag kleag at free.fr
Tue Sep 2 20:15:30 CEST 2003


Le Lundi 1 Septembre 2003 02:41, Andreas Beckermann a écrit :
> On Monday 01 September 2003 03:57, cantabile wrote:
> > BTW, isn't there something strange in "player=(KPlayer *)new
> > ComputerPlayer();" since ComputerPlayer inherits from KGameIO ?
>
> As said im my previous mail - it is _definitely_, 100%, *absolutely* wrong.
> It must crash sooner or later.
>
Hi,

in all cases, pointer casts are terribly dangerous, prefer the C++ cast 
syntaxes:
static_cast<Class>(object);
dynamic_cast<Class*>(pointer);
const_cast<Class>(const_object);
It will help you to find bugs at compile time and at runtime.

Please refer to the documentation for details.

Cheers,

Kleag



More information about the kde-games-devel mailing list