[Kget] Refactor transferhandler & transfergrouphandler?

Lukas Appelhans l.appelhans at gmx.de
Wed Aug 13 16:41:26 CEST 2008


Am Dienstag 12 August 2008 22:25:59 schrieb Carsten Pfeiffer:
> Am Dienstag, 12. August 2008 schrieben Sie:
>
> Hi,
>
> > yep, that's for telling difference between a true base pointer and a
> > sub-class pointer. It can't tell the difference between two
> > sub-classes, and since TransferGroupHandler & TransferHandler are both
> > always Handler type, it always return a valid pointer.
>
> I thought you would dynamic_cast for TransferGroupHandler instead of the
> base Handler class? AFAIK there is no problem to
> dynamic_cast<TransferGroupHandler*>(someHandlerPtr)
that won't work afaik, dynamic_cast can only cast downwards...
>
> Another solution would be to add a pure virtual method isTransferGroup() to
> the base Handler class and then implement it as "return false" in
> TransferHandler and as "return true" in TransferGroupHandler.
Well we have it working now pretty cool with typeid...

Lukas
>
> Cheers,
> Carsten



More information about the Kget mailing list