03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The fundamental rule is, use names to convey meaning. Don't abbreviate too much (use real<br />

English), but don't make names too long and unwieldy. Another basic rule is that application<br />

programming interfaces (APIs) use American English spelling. American English is the<br />

international language of APIs, so expect to see Color, Center, Gray and Synchronize<br />

rather than Colour, Centre, Grey and Synchronise.<br />

3.2.1 Class Names<br />

Classes use an initial letter to indicate the basic properties of the class. The main ones are<br />

as follows:<br />

Category Examples Description<br />

T classes, types TDesC, TPoint,<br />

TFileName<br />

C classes CConsoleBase, CActive,<br />

CBase<br />

R classes RFile, RTimer,<br />

RWriteStream, RWindow<br />

M classes, interfaces MGraphicsDevice-<br />

Map,MGameViewCmd-<br />

Handler,<br />

MEikMenuObserver<br />

T classes don't have a<br />

destructor. They act like<br />

built-in types. That's why the<br />

typedefs for all built-in<br />

types begin with T. T<br />

classes can be allocated as<br />

automatics (if they're not too<br />

big), as members of other<br />

classes, or on the heap.<br />

Any class derived from<br />

CBase. C classes are<br />

always allocated on the<br />

default heap.CBase's<br />

operator new()<br />

initializes all member data to<br />

zero when an object is<br />

allocated. CBase also<br />

includes a virtual destructor,<br />

so that by calling delete<br />

on a CBase* pointer any C<br />

object it points to is properly<br />

destroyed.<br />

Any class that owns<br />

resources other than on the<br />

default heap.Usually<br />

allocated as member<br />

variables or automatics; in a<br />

few cases, can be allocated<br />

on the default heap. Most R<br />

classes use Close() to<br />

free their associated<br />

resources.<br />

An interface consisting of<br />

pure virtual functions and<br />

with no member data. A<br />

class implementing this<br />

interface should derive from<br />

it. M classes are the only<br />

approved use of multiple

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!