Results 1 to 3 of 3

Thread: how to declare a variable as polymorphic?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Posts
    94
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    14
    Thanked 1 Time in 1 Post

    Question how to declare a variable as polymorphic?

    Hello,

    I would like to assign a data type to a variable first during the execution, but not at the beginning yet. How should then I declare such a variable first?

    Below is my code, where I want to use it:

    Qt Code:
    1. polymorphic Data type *net;
    2. polymorphic Data type *netMin;
    3.  
    4. switch(which_network){
    5. case 0: // Linear Output Feed Forward Network was chosen
    6. net = new LinOutFFNet(input, output, connectionMatrix);
    7. netMin = new LinOutFFNet(input, output, connectionMatrix);
    8.  
    9. break;
    10. case 1: // Feed Forward Network was chosen
    11. net = new FFNet(input, output, connectionMatrix);
    12. netMin = new FFNet(input, output, connectionMatrix);
    13.  
    14. break;
    15. case 2: // radial basis function network was chosen
    16. net = new RBFNet(input, output, connectionMatrix);
    17. netMin= new RBFNet(input, output, connectionMatrix);
    18.  
    19. break;
    20. }
    To copy to clipboard, switch view to plain text mode 

    Thank you

    best regards,

    Vitali
    Last edited by rambo83; 17th December 2009 at 11:47.

Similar Threads

  1. how to declare a global variable right
    By Cruz in forum Newbie
    Replies: 13
    Last Post: 16th February 2010, 16:25
  2. Eclipse debugging: Unable to create variable object
    By PUK_999 in forum Installation and Deployment
    Replies: 0
    Last Post: 20th August 2009, 21:42
  3. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 10:15
  4. how to declare a friend variable ?
    By probine in forum General Programming
    Replies: 5
    Last Post: 27th March 2006, 15:00
  5. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11

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
  •  
Qt is a trademark of The Qt Company.