-3
私は3つのクラス、すなわち "Class1"、 "Class2"、 "Class3"と1つのインタフェース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