I am trying to call a method from class A and apply it to a value in class C:
class A
{
//my code here
public virtual string calculatebnft()
{
string bnft = "";
//my code here
return bnft;
}
}
class B : A
{
//my code here
public override string calculatebnft()
{
string bnft = "";
//my code here
return bnft;
}
}
class C : B
{
//my code here
}
In my Main method:
C c1=new C();
//my code here
string bnft=c1.calculatebnft();
MessageBox.Show(bnft);
When I run program it always runs class B's method calculatebnft(). How can I call calculatebnft() from A instead? The rest of code from B "which is working correctly".
Bit will always run the method fromB(unless it is declared asnew, but then it's actually a different method)B, then it should utilizeB's implementation of methods; otherwise, it makes more sense as a parallel implementation ofA.