本文介绍了理解接口和类的差异.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void DepartmentName_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
try
{
((ITransaction)AppVariables.automator.AccountObj).DepartmentID = WebFormHelper.GetAccountIDFromName(DepartmentName.Text, AccountType.departmentMaster);
((ITransaction)AppVariables.automator.AccountObj).DepartmentName = DepartmentName.Text;
}
在上面的代码中,我不明白为什么我们采用了(ITransaction),它称为/意味着(返回类型或其他任何东西)吗?
因为我已经在接口ITransaction中将属性声明为DepartmentID和DepartmentName并在Class Transaction中实现了它.
另外,我们可以在上面的代码段中使用Transaction而不是ITransaction吗?我试过了,它对我有用,但是,没有得到正确的答案(ITransaction或Transaction).
In above code i didnt get why we have taken (ITransaction),what it called/means(return type or anything else)??
as i have declared properties as DepartmentID and DepartmentName in interface ITransaction and implemented it in Class Transaction.
also, can we take Transaction instead of ITransaction in above snippet? i tried this, it works for me but , didnt get what will be correct there(ITransaction or Transaction).
推荐答案
这篇关于理解接口和类的差异.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!