Results 1 to 3 of 3

Thread: Problem with inheritance and object share use?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with inheritance and object share use?

    One of possible solutions is to do reference counting on "E" and copy it by value (with a shared reference counter of course) between those objects that use it. Or if you use Qt, QSharedPointer is the thing you want to use (if you don't but you use C++ you can use boost/std::shared_ptr). And for clarity E should be created outside B to avoid doubts related to ownership of E (since E can live longer than B if it is shared with another object). As for now you are trying to access an already deleted object.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    tonnot (2nd August 2011)

Similar Threads

  1. Object and multiple inheritance for interfaces
    By brcain in forum Qt Programming
    Replies: 8
    Last Post: 29th June 2021, 15:29
  2. Replies: 2
    Last Post: 6th May 2011, 06:56
  3. problem with constructor and inheritance QFile object
    By naturalpsychic in forum Qt Programming
    Replies: 7
    Last Post: 25th January 2011, 10:15
  4. Replies: 4
    Last Post: 20th August 2010, 13:07
  5. Inheritance problem
    By brevleq in forum Qt Programming
    Replies: 6
    Last Post: 23rd December 2008, 06:27

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.