×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    347

    A Base class access issue

    Hello,

    In my code, I have derived my class from CActiveCommsMobilityApiExt.
    In the ConstructL() method of the derived class, I would like to invoke the ConstructL() method of the base class.
    In the SDK documentation for CActiveCommsMobilityApiExt, it has been mentioned that the ConstructL() method is protected.
    So, I would presume that I should be able to invoke this method from my class method.
    I use the following code in the ConstructL() method of my class:
    RConnection iConnection;
    CActiveMobilityApiExt* basePtr = this;
    basePtr->ConstructL(iConnection);

    For the above code, I get the following compiler error:
    illegal access to protected/private member CActiveMobilityApiExt::ConstructL().

    Any suggestions?

    TIA
    Vin

  2. #2
    Registered User
    Join Date
    Sep 2010
    Posts
    31

    Re: A Base class access issue

    Hi Vin,

    I think this will help u sure.

    How to write a derived class with two-phase construction
    This document illustrates how to implement two-phase construction in a derived class with example code.

    When writing a derived class, you must use the derived class ConstructL() to call the correct base class ConstructL().

    Call the base class ConstructL() before the derived-class specific construction starts. This mirrors the action of C++ constructors.

    class CCompoundDerived : public CCompound
    {
    public:
    ...
    protected:
    ...
    void ConstructL();
    private:
    ...
    };void CCompoundDerived::ConstructL()
    {
    this->CCompound::ConstructL();
    // own construction
    }

Similar Threads

  1. Base class pointer
    By amit_yadav in forum Mobile Java General
    Replies: 4
    Last Post: 2009-09-09, 10:21
  2. [moved] Best ListBox base class
    By Jeepy in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-07-09, 21:28
  3. about abstract base class
    By snoopyqhq in forum Mobile Java General
    Replies: 2
    Last Post: 2006-06-09, 10:45
  4. When to call virtual method in base class
    By rossj1 in forum Symbian
    Replies: 1
    Last Post: 2004-03-16, 08:42
  5. Abstract base class in a library
    By Mauri in forum Symbian
    Replies: 0
    Last Post: 2003-05-08, 14:08

Posting Permissions

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