Background
I am working on a phonetic converter program which converts english text into equivalant regional language text. Regional languages will have more characters than english letters and regional language fonts uses almost all positions (1-255) in a font.
My program supports different fonts and I have created a font class which will have methods gives access to the characters. This class will have 255 methods each representing each character. All these are marked as virtual so that a new font can override necessary character methods.
The methods in this font class are trivial. All methods are single line. Example would be
string StandardFont::consonant1(){
return "a";
}
string StandardFont::consonant2(){
return "b";
}
..
Questions
- Will 255 virtual functions in a single class make any performance issues? I know about vtable stuff, but I am not sure how much impact it has in this scenario.
- Can anyone suggest an alternate design for this class? Main design goal is to allow derived classes to override necessary methods. I have thought about adding the characters into containers like map or vector and providing method to get the character. But since I will have 255 items and this class is used frequently, I think each time I have to loop the container to get the character, which is again an issue.
Any thought?