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. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with inheritance and object share use?

    This is the skeleton of my app.
    Qt Code:
    1. - ClassA has a ClassE * myclassE_inside_A public var.
    2. - ClassB Inherits ClassD
    3. - ClassC Inherits ClassD
    4.  
    5. - ClassD has some funtions and *ClassE public var.
    To copy to clipboard, switch view to plain text mode 

    The idea was to deal with classE instance from class A, B and C. And use some common methods of ClassD from ClassB and ClassC.

    Pseudocode that describes its operation.
    Qt Code:
    1. Inside ClassA:
    2. ClassB my_classB;
    3. my_classB.create; (I have the *ClassE filled with data )
    4. myclassE_inside_A = my_classB.classE;
    5.  
    6. ClassC my_classC;
    7. ClassC.set_classE(my_classE_insideA);
    8. for( )
    9. { do some things with my_classE_inside_A ;
    10. classC.modify_some_things_on_classE }
    11.  
    12. - classC.modify_some_things_on_classE uses own methods and one function inheritated from classD.
    To copy to clipboard, switch view to plain text mode 

    When I run the program I have a lot a heap error and a lot of crahes
    HEAP: Free Heap block c977e28 modified at c977e5c after it was freed
    (Internal error: pc 0x2ff in read in psymtab, but not in symtab.)
    (Internal error: pc 0x2ff in read in psymtab, but not in symtab.)
    (Internal error: pc 0x2ff in read in psymtab, but not in symtab.)
    ,,,,

    The error was related with classC, after the first modification of classE object. the second time I use it (it is the same if I do it from myclassE_insideA or int classC) i have the crash.
    I'm sure that I' forget to do something but I dont view it.

    It is as If I can't use the classE object by pointer. ?

    Any idea ?
    Last edited by tonnot; 1st August 2011 at 11:55.

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.