×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    153

    Difference between ConstuctL and baseConstructL

    Hi pals,

    I know the fact about ConstructL is "it is used to create an object which invoke it.But BaseConstructL is invoked by AVKON framework and we do not need to invoke it""

    My query is that
    (1) Then for what purpose we have use BaseConstructL()in our programming?any specific use...

    As up to now i have received so many clarification on my doubt from this beautiful forum and hope for the future also..

    Thanks for your valuable reply dude.

    Pankaj.

  2. #2
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    66

    Re: Difference between ConstuctL and baseConstructL

    Hi,
    you will get answer for thsi in SDK help just search for BaseconstructL.for your info check below..

    In deriving an AppUi class from CAknAppUi (Series 60) one comes across the following inconsistency

    case - "Constructing of a Series 60 AppUi"
    [CxxxAppUi is derived from CAknAppUi]
    void CxxxAppUi::ConstructL()
    {
    BaseConstructL();
    //CAknAppUi::ConstructL() - does not work here!?
    ...
    }

    in the Series 60 UI, CAknAppUi only defines a BaseConstructL() method and does not provide a corresponding version of ConstructL(). Therefore, using the form:

    void CMyOwnAppUi::ConstructL()
    {
    CAknAppUi::ConstructL();
    iAppView = CHelloGuiAppView::NewL(ClientRect());
    }

    will fail to correctly construct the Series 60 App UI.

    Calling BaseConstructL() from a derived class is essential for the Series 60 interface, since calling ConstructL() in that case would result in calling CEikAppUi::BaseConstructL() (from which it derives), thus missing the CAknAppUI::BaseConstructL().

    Nevertheless, this does not mean, that when one designs a new CxczAppUi, one shouldn't make use of a CxczAppUi::ConstructL(). It is actually recomended that one should, so that any specific initialisation that does not deal purely with base construction can be encapsulated there.



    Regards
    Satya

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: Difference between ConstuctL and baseConstructL

    BaseConstructL is a convention: in standard C++, the constructors of parent classes are inherently invoked. This also happens in Symbian C++, however in Symbian C++, two-phased construction may come into the picture, and there is no mechanism for ensuring that ConstructL of the parent class will be invoked.
    For clearing the picture a bit the name BaseConstructL was invented for classes which are meant to be derived from. If you are extending a class, and you see that it has a BaseConstructL method, that should be invoked as the first line of your own ConstructL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×