Also:
// This does nothing good; numfont just contains some garbage value // as it has not been initialized, and every Font object will have // their own garbage numfont. // If you want to keep book of the number of Font objects created, // numfont should be declared static and defined in the .cpp like this: // int Font::numfont = 0; numfont++; // This shouldn't even compile; extension is a char*, but string literals // (such as ".pcx") are of type const char*. extension = ".pcx"; // In the best case, this will probably crash your program. // In the worst case, it will just cause some erratic behaviour. // strcat assumes that there is enough room in fontname for extension, // but there very probably won't be -> it happily writes outside // the bounds of fontname, with unfortunate consequences. // Use the std::string! char*loadshit = strcat(fontname, extension);