Results 1 to 5 of 5

Thread: association between 2 classes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: association between 2 classes

    I once planned to do everything with forward declarations, hoping it would be a universal solution. But how do I do this with classes that use templates?

    Oh well, if I can't I can't. I can make an exception in that case if I have to.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  2. #2
    Join Date
    Mar 2006
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: association between 2 classes

    Don't make it a general rule to use forward declarations. It can be used in many many cases, but sometimes it is simply very usefull to include the actual header file.

    With templates, you can be in luck depending on the implementation. As the template functions are only expanded when called, the conflict may or may not be there. If you do have problems, you should either unlink the two classes, or make a 'master' class which handles the communication between the two classes. I probably don't have to advise you to prevent 2 classes being linked to eachother

Similar Threads

  1. QtTest: Unittesting in several classes
    By Jojo in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2009, 12:38
  2. Professional Classes & Objects Structure
    By webstylemedia in forum Newbie
    Replies: 4
    Last Post: 4th August 2008, 10:50
  3. Design classes in OOP?
    By vql in forum General Programming
    Replies: 5
    Last Post: 25th October 2007, 14:18
  4. Qcj Data classes initial release
    By croftj in forum Qt-based Software
    Replies: 0
    Last Post: 1st May 2007, 02:51
  5. Adding nonQt classes to QtApplication
    By codebehind in forum Newbie
    Replies: 11
    Last Post: 23rd April 2007, 21:08

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.