Next Previous Contents

5. Rename String class! How??

If you want to rename the String class, just in case you do not like the name or if there is a conflict with another name class with same name 'String'. You can use this technique, in all the files where you do include String.h, insert these lines:


#define  String  String_somethingelse_which_I_want
#include "String.h"
#undef String

// All your code goes here...
main()
{
        String_somethingelse_which_I_want aa;

        aa = " some sample string";
        .......
}

The pre-processor will replace all literals of String to "String_somethingelse_which_I_want" and immdiately undefines String
Next Previous Contents