我希望对程序设计方法有以下帮助/指导。程序设计方法
我正在开发一个类,其中我有这个类,属性算出来了,如下所示;
class PanelBlock{
public:
PanelBlock();
private:
TCHAR m_sSlope[PANEL_NAME_LENGTH]; // To store the Slope
bool m_bTopPanel; // This is to identify the
bool m_bMidPanel; // location of the PanelBlock.
bool m_bBotPanel;
// Similarly we have it for other attributes.
// My Question here is,
// Is it better to have a TCHAR instead of 3/5 booleans here?
TCHAR m_sPanelLocation[PANEL_LOCATION_LENGTH];
}
我的问题在这里,
是更好地有TCHAR /字符串的而不是3/5布尔值吗?在我 应用程序代码中,我只是比较TCHAR /字符串与特定 TCHAR /字符串,说如果该位置是TOP,做任务A,或者不具有 有我缺少任何优势布尔?
另外,我有周围8个属性为此我需要布尔以 确定它是否在顶部,中部或底部。
任何帮助/指导将不胜感激。
您是否使用'TCHAR',因为它们是显示字符串,并且您需要使用相同的来源在多字节和宽字符之间切换,还是其他内容? –
为什么不是枚举? – user93353
@RetiredNinja你是正确的那些是显示字符串。 – JNL