# Naming

You will notice that class names in Symbian begins with different letters. The letter with which they begin depends on the type of the class.

If the name begins with T then it is a so called T class. Such classes cannot own external data - i.e. they cannot have pointers to data that is not owned by a different object. Such classes usually don't need a destructor. They can be created on the stack (i.e. as automatic variables) or inlined in a class.

If a class owns some external data, then it must be a subclass (direct or indirect) of CBase and it's name will begin with C - this will be a C class. The CBase provides a virtual destructor, so even after casting to CBase * the right destructor will be called. Another nice feature of C classes is that it fills the data area with 0s, so you don't need to initialize variables to 0 or NULL (what is the most common case). Because the C classes will be pushed on the cleanup stack (which will be described later), C classes cannot be created on the stack - they must be created with the `new` operator (usually `new(ELeave)` as will be explained later).

Somehow analogical to T and C classes are the `struct`s and `class`es in C#. Symbian uses also classes which are analogical to Java or C# `interface`s. They are prefixed with M and can contain only pure virtual functions. Symbian discourages multiple inheritance unless all the superclasses except at most one are M classes.

The last commonly used prefix is R. These classes access to some external resources (e.g. files, sockets) and needs to be closed before exit. These classes don't have a common ancestor and there is no single closing function. The closing function is most often called `Close()`, sometimes `Dispose()` or `Delete()`.

There is also a convention for variables names - the class fields have names starting with 'i' while functions arguments have names beginning with 'a'.

Note that although the T classes can be created on the stack it is not allways the best idea. The stack on the device is very small - by default 8kB. Some T classes are relativly big - e.g. a `TFileName` uses more then 512 bytes. The emulator uses the Windows NT stack (which can grow up to 8MB by default), so you will notice the overflow only when testing on the device.

Another Symbian feature is that DLLs cannot contain static data. The problem is that applications (`*.app` files) are DLLs, so when writing an application you should not use static data. Static data can be used in servers (`*.exe`).