Adding a new variable in Class is creating problem.(making parent Null)

Discussion in 'C++' started by sharat, Feb 17, 2012.

  1. sharat

    sharat Guest

    Hi,

    I am facing a strange problem.
    I am working with already implemented very big code of project in C++.

    Its related to GUI function.

    I have added a new button to a dialog and its functionality.
    Everything works fine if I declare the local variable in Class
    constructor. but I observed if I declare any variable in .h file
    inside a class definition then its making the parent window's
    pointer's(look up on parent) NULL. I am not getting that declaring
    variable in class deification , how it is creating problem?

    is this related to some inheritance already defined design patterns or
    anything else, might be a small problem.

    Please help.
    thanks in advance.
     
    sharat, Feb 17, 2012
    #1
    1. Advertising

  2. On Feb 17, 8:13 am, sharat <> wrote:
    > Hi,
    >
    > I am facing a strange problem.
    > I am working with already implemented very big code of project in C++.
    >
    > Its related to GUI function.
    >
    > I have added a new button to a dialog and its functionality.
    > Everything works fine if I declare the local variable in Class
    > constructor. but I observed if I declare any variable in .h file
    > inside a class definition then its making the parent window's
    > pointer's(look up on parent) NULL. I am not getting that declaring
    > variable in class deification , how it is creating problem?
    >
    > is this related to some inheritance already defined design patterns or
    > anything else, might be a small problem.


    can you post a short example that illustrates your problem?
     
    Nick Keighley, Feb 17, 2012
    #2
    1. Advertising

  3. sharat

    sharat Guest

    On Feb 17, 2:48 pm, Nick Keighley <>
    wrote:
    > On Feb 17, 8:13 am, sharat <> wrote:
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > > Hi,

    >
    > > I am facing a strange problem.
    > > I am working with already implemented very big code of project in C++.

    >
    > > Its related to GUI function.

    >
    > > I have added a new button to a dialog and its functionality.
    > > Everything works fine if I declare the local variable in Class
    > > constructor. but I observed if I declare any variable in .h file
    > > inside a class definition then its making the parent window's
    > > pointer's(look up on parent) NULL. I am not getting that declaring
    > > variable in class deification , how it is creating problem?

    >
    > > is this related to some inheritance already defined design patterns or
    > > anything else, might be a small problem.

    >
    > can you post a short example that illustrates your problem?


    Thanks!! But My problem got solve.

    I have declared the variable after declaration of parent window
    pointer. and it works!
     
    sharat, Feb 17, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    1,879
    Andrew Thompson
    Jan 12, 2005
  2. Replies:
    5
    Views:
    26,709
    Mike Schilling
    Mar 29, 2006
  3. Replies:
    1
    Views:
    515
    Pavel Lepin
    Feb 19, 2008
  4. metal
    Replies:
    8
    Views:
    510
    Bruno Desthuilliers
    Oct 30, 2009
  5. Marco
    Replies:
    4
    Views:
    136
Loading...

Share This Page