From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: vin2ktalks (20 Mar 2007)
Last edited: hamishwillee (20 Jul 2012)

Constructor creates an object and initializes it. It also creates vtable for virtual functions. It is different from other methods in a class.

Some Important facts about Constructor in Symbian:

  • Never leave from a C++ constructor.
  • Never allocate memory from within a C++ constructor.
  • Put construction functions that might leave into a second-phase constructor such as ConstructL().
  • Instead of expecting your user to call ConstructL() and/or a C++ constructor explicitly, use NewL() and NewLC() to wrap up allocation and construction. You can enforce this by making the C++ constructors private.

This page was last modified on 20 July 2012, at 09:22.
51 page views in the last 30 days.