i'm trying to figure a way on how to use interface inheritance and how i can work around a situation where the type is determined at runtime. Assuming the following
interface Ibase
{
void B()
}
interface Ichild1: Ibase
{
void C1()
}
interface Ichild1: Ibase
{
void C2()
}
class Class1 : Ichild1
{
// needs to provide implementation for methods B() and C1()
}
class Class2: Ichild2
{
// needs to provide implementation for methods B() and C2()
}
IBase getClass(credentials)
{
case 1:
return Class1()
case 2:
return Class2()
}
MainProgram
IBase ref = getClass("XQE");
ref. //-> only B() method is available...
How can i work around this situation in this specific case Thank you.
Aucun commentaire:
Enregistrer un commentaire