- Classes that don't own external objects/resources and so can be declared on the stack 'T'types contain their value.
- They do not own any external object, either directly (by pointer) or indirectly (by handle).
- they do not need a destructor to cleanup resources.
- 'T' types may be allocated either on the stack (that is locally as C++ automatic variables) or as members of other classes.
- note that the default stack size is 8KB in Symbian OS.
- Structure types mostly begin with 'T'.
'C' Classes
If a class needs to dynamically allocate any memory or own another class, it should derive, directly or indirectly, from CBase (a built-in Symbian OS class), and its class name should begin with 'C'. CBase-derived classes have the following properties:
- They are allocated on the heap (dynamically allocated) — not on the stack, and not as members of other classes.
- The allocator used for this class hierarchy initializes all member data to binary zeroes.
- They are passed by pointer, or reference, and so do not need an explicit copy constructor or assignment operator unless there is clear intention that a particular class supports copying.
- They have a virtual destructor, which is used for standard cleanup processing.
- They support two-phased construction – this will be covered later in the section.
'R' Classes
These classes are used to access system resources, for example files, via handles. The following are characteristics of ‘R’ classes:
- They contain a handle that is used to pass on requests to other objects.
- They are opened using an "Open()" function particular to the ‘R’ class, and closed using a "Close()" function particular to the class. An ‘R’ object must be closed once if it has been opened.
- They may be freely bit-wise copied.
- They have no explicit constructor, destructor, copy constructor or assignment operator.
'M' Classes
Characteristic:
- Abstract
- Pure virtual functions
- No member data
- define an interface
- reduce dependencies between classes
- the only use of multiple inheritance
- A C class derive from one other C class and zero or more M classes
- They should contain no member data.
- They should not contain constructors or destructors, or overloaded operators.
No comments:
Post a Comment