Passing data to overridden base method in C#
- by UpTheCreek
Bit of a dumb question, but I'm wondering what the accepted way of passing data from back to an overridden base method is in c#.
e.g. I guess I could do:
class A
{
int x;
public virtual void DoStuff() {
Console.WriteLine(x);
}
}
class B : A
{
public override void DoStuff() {
x = 1;
base.DoStuff();
}
}
But is there a better method that for example doesn't require the use of a member variable?