#Base and This
1 messages · Page 1 of 1 (latest)
this is the current object the code is executing on, the context the code runs on
base is accessor for the superclass
and in which case do you use it?
base most often for calling implementation of virtual/abstract methods in the base class
this when you need to differentiate the local variable, from member variable, or any other case when you need to access current object, or pass it somewhere
class Foo{
public void AcceptBar(Bar bar) {}
}
class Bar{
void DoStuff()
{
var f = new Foo();
f.AcceptBar(this);
}
}