本文介绍了需要动态创建枚举的想法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在从事会计项目.在我的帐户类中,我们有一个AccountType作为枚举...

Hi guys, am working in a accounting project. In my account class we have a AccountType as enumeration...

class Account
{
.....
        enum 
	{
		None       = -1,
		Cash       = 0,
		Saving     = 1,
		CreditCard = 2,
		Checking   = 3,
		Investment = 4,
		Mortgage   = 5
	};
......

};


并且数据库还包含AccountType表.我们正在使用某些脚本通过Web升级我们的产品.我的任务是,当脚本在AccountType表中添加更多字段时,Account类中的枚举也需要更新该值.

在我的搜索中,我发现枚举是编译时间常数,因此,如果还有其他可能的话,我该如何实现呢?

在此先感谢
ganesh_IT


and database also contains AccountType table. We are upgrading our product through web using some script. My task is when the script add more fields int the AccountType table the enum in Account class also need to update that value.

In my search i found enumerations are compile time constants, so how can i achieve this , if any other possibility is there pls guide me with your valuable ideas.

Thanks in advance
ganesh_IT

推荐答案


这篇关于需要动态创建枚举的想法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:28