mercredi 8 avril 2015

Overriding a method twice in a class

I need to override a method twice in a class for two different behaviors. example:


Abstract Class1:



public abstract class A : ReadVar_Class
{
public Ex_Interface ex_Interface1;

public abstract void AbtractExample();
}


I want to be able to define the abstract method for 2 different behaviors in another Abstract class. But i am not allowed to do it in the same class, is there a way i can achieve this? The constraint is that the framework is built with the abstract class type.


Abstract Class 2:



public abstract class B:A
{
public override void AbstractExample()
{
ex_Interface1 = new InterfaceClass1();
ex_Interface1.SearchField();
}

public override void AbstractExample()
{
ex_Interface1 = new InterfaceClass2();
ex_Interface1.SearchField();
}
}


Thanks in Advance!


Aucun commentaire:

Enregistrer un commentaire