Article View: borland.public.cppbuilder.nativeapi
Article #2609Re: dynamic_cast does not work in packages
From: Remy Lebeau (TeamB)
Date: Mon, 05 Feb 2007 18:56
Date: Mon, 05 Feb 2007 18:56
25 lines
1781 bytes
1781 bytes
"Dmitry" <dmitry@pikalevo.com> wrote in message news:45c4f2a7@newsgroups.borland.com... > maybe someone will give me idea how can i overcome this problem. The only way for RTTI to work across packages is to enable runtime packages. It does not sound like you are doing that. > the TDataSetActions use TMyDataSet descendant inside package1, > when user fires event for dataset, i need to cast a DataSet to TMyDataSet > > TMyDataSet *a_MyDataSet = dynamic_cast<TMyDataSet *>(DataSource->DataSet) > > and it this gives a NULL. If you know for a fact that the DataSet is always a TMyDataSet, then you should be using static_cast instead of dynamic_cast. The only time you should ever use dynamic_cast is when you are not sure what the actual type is going to be. Gambit
Technical Details
Message-ID:
<45c77dc3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!64.192.187.27!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<45c1f643@newsgroups.borland.com> <45c2330e$1@newsgroups.borland.com> <45c4f2a7@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,eea25a98edb328b5 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <45c1f643@newsgroups.borland.com> <45c2330e$1@newsgroups.borland.com> <45c4f2a7@newsgroups.borland.com> Subject: Re: dynamic_cast does not work in packages Date: Mon, 5 Feb 2007 10:56:53 -0800 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <45c77dc3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170701763 75.83.34.171 (5 Feb 2007 10:56:03 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!64.192.187.27!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail