OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Vikas Goyal (vikas_at_SDC.CANON.CO.IN)
Date: Wed Jan 29 2003 - 05:41:28 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi Krushna,

    Modifying the default parameter in overidden function is not suggested.
    Here actually show() version of derived is getting called. You can check
    this if you modify the derived version of show()

    show(int iVal=1000)
            {
                cout<<iVal<<endl;
                cout<<endl<<"Derived is called";
            }

    regards,
    --vikas

                          Krushna
                          <bkrushnaHOTMAIL To: DCOMDISCUSS.MICROSOFT.COM
                          .COM> cc:
                          Sent by: Subject: Re: behaviour of DllMain
                          Distributed
                          COM-Based Code
                          <DCOMDISCUSS.MIC
                          ROSOFT.COM>

                          29/01/2003 17:01
                          Please respond to
                          Distributed
                          COM-Based Code

    Hi All,
    Can Anybody tell me When deafult parameter of virtual function get resolved
    and how?
    for example I have 2 class
    Class Base
    {
    public:
            virtual show(int iVal=100)
            {
                cout<<iVal<<endl;
            }
    }

    Class Derived : public Base
    {
    public:
            show(int iVal=1000)
            {
                cout<<iVal<<endl;
            }
    }

    Main
    {
    Base *ptr= new Derived;
    ptr->show();
    }

    Output is 100 while debugging actually derived class function is getting
    executed why ?

    }
    ----- Original Message --

    ---
    From: "Ximon Eighteen" <ximon_eighteen3B2.COM>
    To: <DCOMDISCUSS.MICROSOFT.COM>
    Sent: Wednesday, January 29, 2003 4:27 PM
    Subject: Re: behaviour of DllMain
    

    > > but then why the other call was made to DllMain ???? > > There are four times that DllMain can be invoked. From the documentation of > DllMain:- > > - DLL_PROCESS_ATTACH > - DLL_THREAD_ATTACH > - DLL_THREAD_DETACH > - DLL_PROCESS_DETACH > > In your case I presume you are seeing DLL_PROCESS_ATTACH followed by > DLL_THREAD_ATTACH. > > Ximon Eighteen > > ---------------------------------------------------------------- > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp > contains important info. Save time, search the archives at > http://discuss.microsoft.com/archives/index.html . > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM >

    ---------------------------------------------------------------- Users Guide http://discuss.microsoft.com/archives/mailfaq.asp contains important info. Save time, search the archives at http://discuss.microsoft.com/archives/index.html . To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ---------------------------------------------------------------- Users Guide http://discuss.microsoft.com/archives/mailfaq.asp contains important info. Save time, search the archives at http://discuss.microsoft.com/archives/index.html . To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM