-3
我有三個類,即「Class1」,「Class2」和「Class3」以及一個接口IBase。設計建議 - 具有屬性,接口(或摘要)的類 - 接入問題
interface IBase
{
+ PrpCommon {get;set;}
}
Class1:IBase
{
+ PrpCommon {get;set;}
+ Class1Prp {get;set;} (and few other properties)
}
Class2:IBase
{
+ PrpCommon {get;set;}
+ Class2Prp {get;set;} (and few other properties)
}
Class3:IBase
{
+ PrpCommon {get;set;}
+ Class3Prp {get;set;} }
AccessClass
{
AccessFunction(IBase)
{
return IBase.PrpCommon;
// here i need to access the other properties like Class3Prpr or Class2Prp or Class1Prp.
}
}
MainClass
{
AccessClass.AccessFunction(new Class1)
// Here need to access the other properties like Class3Prpr or Class2Prp or Class1Prp.
}
是否有可能???我聽說通過一些構造函數,可以訪問它,但不通過接口...任何想法。
謝謝,我期待這樣......再次感謝你...... :) – kamal