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. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: how to declare a variable as polymorphic?

    I guess you need to go back to OOP basics... All you need is to have a base class, possibly pure virtual (i.e abstract, an interface, ...), for instance AbstractNet, which would define the base API of all network classes (e.g read(), write(), ...) and all other classes would inherit from that base class and reimplement the proper methods.

    Then "declaring a variable as polymorphic" boils down to declaring it as a pointer to an object of the base class.
    Current Qt projects : QCodeEdit, RotiDeCode

  2. The following user says thank you to fullmetalcoder for this useful post:

    rambo83 (17th December 2009)

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.