×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    231

    Convert pure C++ class to Symbian C++ class

    Hi, I am a new Symbian developer, I want convert a pure C++ class to Symbian C++ class.

    My pure C++ class:

    Code:
    class Vehicle{
        private:
          int   Year;
        public:
          Vehicle(int year);
          ~Vehicle(void);
    }; 
    
    Vehicle::Vehicle(int year){
        Year = year;
    }
    My Symbian adaptation:

    CVehicle.h

    Code:
    class CVehicle : public CBase
    	{
    public:
    	CVehicle(TInt);
    	virtual ~CVehicle();
    private:
    	TInt iYear;
    	};
    CSimple.cpp

    Code:
    CVehicle::CVehicle(TInt aYear)
    	{
    	// TODO Auto-generated constructor stub
        iYear = aYear;
    	}
    
    CVehicle::~CVehicle()
    	{
    	// TODO Auto-generated destructor stub
    	}
    The adaptation is ok and it is not generate errors.

    Now, I wat to convert a C++ class with char* members:

    Code:
    class Vehicle{
        private:
          int   Year;
          char* Owner;
        public:
          Vehicle(int year, char* owner);
          virtual ~Vehicle(void);
    };
    My Symbian code:

    Cfoo.h

    Code:
    class CVehicle : public CBase{
        private:
          TInt   iYear;
          HBufC  iOwner;
        public:
          CVehicle(TInt year, TDesC Owner);
          virtual ~CVehicle(void);
    };
    ¿Is it correct?

    Best regards.
    Last edited by symbi4n_programmer; 2009-02-28 at 21:29.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Convert pure C++ class to Symbian C++ class

    HBufC iOwner;
    it must be HBufC* iOwner;

  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    231

    Re: Convert pure C++ class to Symbian C++ class

    Quote Originally Posted by skumar_rao View Post
    it must be HBufC* iOwner;
    Thank you very much.

    The constructor method is right?

    Code:
    CVehicle(TInt year, TDesC Owner);
    Best regards.

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Convert pure C++ class to Symbian C++ class

    You probably want

    Code:
    CVehicle(TInt aYear, const TDesC& aOwner);
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  5. #5
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    231

    Re: Convert pure C++ class to Symbian C++ class

    Thank you very much.

    This is my class now:

    Code:
    class CVehicle : public CBase{
        private:
          TInt   iYear;
          HBufC* iOwner;
        public:
          CVehicle(TInt aYear, const TDesC& aOwner);
          virtual ~CVehicle(void);
    };
    Last edited by symbi4n_programmer; 2009-03-01 at 17:01.

Similar Threads

  1. External Linking Error (Undefined Symbol)
    By nile_mail in forum Symbian C++
    Replies: 2
    Last Post: 2008-08-05, 13:10
  2. Global Symbian Development Opportunities *High Importance*
    By sara.lindsay in forum Symbian C++
    Replies: 2
    Last Post: 2004-05-08, 09:09
  3. How to convert 'class TBuf8<60>' to 'const class TDesC16 &'
    By wingfancy in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-05-08, 12:58
  4. Replies: 2
    Last Post: 2003-03-18, 06:38
  5. Replies: 1
    Last Post: 2002-06-12, 13:57

Posting Permissions

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