lundi 21 août 2017

Design Suggestion - Class with Properties, Interface ( or abstract ) - Access issues

I have a three classes namely "Class1", "Class2" and "Class3" and one interface 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.
 }

Is it possible??? I heard that through some constructor and can access it., but not through the Interface... Any idea.


Aucun commentaire:

Enregistrer un commentaire