Lưu ý rằng chức năng NewL () được thực hiện trong điều khoản của NewLC () chức năng hơn là cách khác xung quanh (đó sẽ là hơi kém hiệu quả hơn vì điều này sẽ làm cho một PushL thêm () kêu gọi các ngăn xếp dọn dẹp). Mỗi chức năng trả về một đối tượng xây dựng đầy đủ, hoặc sẽ để lại, | Simpo PDF Merge and Split Unregistered Version-I http Note that the NewL function is implemented in terms of the NewLC function rather than the other way around which would be slightly less efficient since this would make an extra PushL call on the cleanup stack . Each function returns a fully constructed object or will leave either if there is insufficient memory to allocate the object that is if the special Symbian OS overload of operator new leaves or if the second phase ConstructL function leaves. If second phase construction fails the cleanup stack ensures both that the partially constructed object is destroyed and that the memory it occupies is returned to the heap. The NewL and NewLC functions may of course take parameters with which to initialize the object. These may be passed to the simple constructor in the first phase or the second-phase ConstructL function or both. If your class derives from a base class which also implements Con-structL you will need to ensure that this is also called if necessary when objects of your class are constructed C will ensure that the simple first-phase constructors of your base classes are called . You should call the ConstructL method of any base class explicitly using the scope operator in your own ConstructL method to ensure the base class object is fully constructed before proceeding to initialize your derived object. It is with class inheritance in mind that we can answer the following question If it is possible to PushL a partially constructed object onto the cleanup stack in a NewL function why not do so at the beginning of a standard constructor thus allowing it to leave calling Pop when construction is complete At first sight this may be tempting since the single-phase construction I described as unsafe at the beginning of the chapter would then be leave-safe as long as the object was pushed onto the cleanup stack before any leaving operations were called in the constructor. However if the class .