Results 1 to 2 of 2

Thread: cast

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default cast

    Hi, ineed to do something like this but doesn't compile. is it possible? thanks
    Qt Code:
    1. int tt=5;
    2. QString x = dynamic_cast<QString> (tt);
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: cast

    You can use dynamic_cast only to cast a pointer (reference) to base class to a pointer (reference) to derived class.

    Use QString::number() instead.

Similar Threads

  1. cast QString-GLenum
    By mickey in forum General Programming
    Replies: 1
    Last Post: 6th July 2006, 14:52
  2. Cast problem
    By yellowmat in forum Newbie
    Replies: 3
    Last Post: 7th February 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.