tailieunhanh - Symbian OS ExplainedEffective C++ Programming for Smartphones phần 2

Chúng tôi muốn kết luận này xem xét hiệu suất mất mát, bằng cách so sánh số lượng các giai đoạn K cần thiết cho mộtMất hiệu suất so sánh các kiến trúc khác nhauLưu ý rằng NewL () chức năng là tĩnh, vì vậy bạn có thể gọi nó mà không có một thể hiện của lớp. | 12 CLASS NAME CONVENTIONS ON SYMBIAN OS are classes in Symbian OS code itself which do not fit the ideals I ve put to you above. There are a few classes in Symbian OS which don t even conform to the naming conventions. Two well-documented exceptions are the kernel-side driver classes and the heap descriptor HBufC which is discussed further in Chapter 5. This doesn t mean that the code is wrong - in many cases there are good reasons why they do not fit the theory. In the lower-level code in particular you ll find cases which may have been written before the name conventions were fully established or which for efficiency reasons have different characteristics and behavior. Whenever you come across a new class it s worth comparing it to the rules above to see if it fits and if not considering why it doesn t. You ll be able to add a set of good exceptions to the rules to your list of cunning Symbian OS tricks while discarding any code that unnecessarily contravenes the conventions - thus learning from others mistakes. Summary This chapter reviewed the major class types used when coding for Symbian OS and described their main features such as any special requirements when constructing or destroying objects of the class whether they can be stack- or heap-based and typical member data contained by the class if any . In particular the chapter discussed the use of the class name conventions to indicate the cleanup characteristics of objects of the class in the event of a leave. The guidelines within this chapter should be useful when writing a class - they can help you save time when coding and testing it if only by cutting down on the rewrite time. If you can stick as closely as possible to Symbian OS conventions your clients will know how you mean your class to be constructed used and destroyed. This naturally benefits them but can also help you reduce documentation and support-time further down the track. 2 Leaves Symbian OS Exceptions Go away. I m all right Said to