Results 1 to 10 of 10

Thread: Problem of inheritance

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2012
    Posts
    90
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5
    Thanked 20 Times in 18 Posts

    Default Re: Problem of inheritance

    Quote Originally Posted by amleto View Post
    no, just no.
    Could you please elaborate on that? I use similar approach sometimes and it would be good to hear about downsides.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Problem of inheritance

    I would probably do it the other way around, i.e. letting the UI class have a pointer to the non-UI/logic class. This way the logic is more independent of the concrete UI implementation and UI can be changed more freely.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: Problem of inheritance

    Quote Originally Posted by lanz View Post
    Could you please elaborate on that? I use similar approach sometimes and it would be good to hear about downsides.
    by changing inheritance for composition the overall design hasn't changed, just the implementation. It appears that the two concrete classes still cannot do a job by themselves, and still require each other to do a job.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  4. The following user says thank you to amleto for this useful post:

    lanz (25th February 2013)

Similar Threads

  1. Problem with inheritance and object share use?
    By tonnot in forum General Programming
    Replies: 2
    Last Post: 1st August 2011, 18:08
  2. problem with Inheritance and QTreeView
    By Kicer in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2010, 15:10
  3. Inheritance problem
    By brevleq in forum Qt Programming
    Replies: 6
    Last Post: 23rd December 2008, 06:27
  4. problem in widget inheritance
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2008, 07:35
  5. subclassing/inheritance QObject problem
    By cbeall1 in forum Qt Programming
    Replies: 12
    Last Post: 13th February 2006, 17:49

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.