initinstance logics.. - Programmer

This is a discussion on initinstance logics.. - Programmer ; if for example, I create an application class which is derived from a CWinApp class, I am supposed to overide the InitInstance virtual method to do all my initializations... How can this method be called from the base class constructor, ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: initinstance logics..

  1. initinstance logics..

    if for example, I create an application class which is derived from a
    CWinApp class, I am supposed to overide the InitInstance virtual
    method to do all my initializations...

    How can this method be called from the base class constructor, as a
    virtual method declared in a derived class can not be called from the
    base class (the derived class does not exist in that stage...)

    how is it done???

  2. Re: initinstance logics..

    "Groni" skrev i en meddelelse
    news:ef5bbc87.0402260034.532b6a40@posting.google.c om...
    > if for example, I create an application class which is derived from a
    > CWinApp class, I am supposed to overide the InitInstance virtual
    > method to do all my initializations...
    >
    > How can this method be called from the base class constructor, as a
    > virtual method declared in a derived class can not be called from the
    > base class (the derived class does not exist in that stage...)
    >
    > how is it done???


    It's the other way around. When you have a virtual method, the derived
    class's method will be called. In the derived class, you can choose to call
    the base class's method or not.

    --
    Bjarne Nielsen



  3. Re: initinstance logics..

    In article ,
    ariel_gronau2@yahoo.com (Groni) wrote:

    > if for example, I create an application class which is derived from a
    > CWinApp class, I am supposed to overide the InitInstance virtual
    > method to do all my initializations...
    >
    > How can this method be called from the base class constructor, as a
    > virtual method declared in a derived class can not be called from the
    > base class (the derived class does not exist in that stage...)
    >
    > how is it done???


    What makes you think that InitInstance gets called from CWinApp's
    constructor?

    Just trust MFC to fully construct your app object, _then_ call its
    InitInstance() member function.

+ Reply to Thread