[Qt-interest] Passing QList<QStringList> as arguments

Thiago Macieira thiago at kde.org
Wed Aug 25 08:35:38 CEST 2010


On Wednesday 25. August 2010 00.45.48 John Weeks wrote:
> C++ does have dynamic_cast<>() that allows you (if you have run-time  
> type information enabled) to get a pointer to a derived class if you  
> hold a pointer to the base class. You have to be ready for an  
> exception to be thrown if the pointer you hold really isn't a pointer  
> to the derived class, though.

dynamic_cast of pointers doesn't throw. It returns zero if the cast failed.

dynamic_casting references, however, does throw std::bad_cast if the cast 
failed.

PS: I've always used upcast and downcast as towards derived and towards base, 
respectively. See:

http://qt.gitorious.org/qt/qt/blobs/master/tests/auto/qsharedpointer/tst_qsharedpointer.cpp#line484
http://qt.gitorious.org/qt/qt/blobs/master/tests/auto/qsharedpointer/tst_qsharedpointer.cpp#line552
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100825/e7113b9e/attachment.bin 


More information about the Qt-interest-old mailing list