I’m looking at someone’s code and has:
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e); //necessary?
if (...)
}
Now, question is why base class method is called? this code would work without that anyway. any idea?
Thanks.
Amit
The base calls are used when you want to utilize the functionality of the base’s implementation yet want to extend what happens in the derived classes implementation.
This can do some really useful things like setting up properties that are defined in the base class or handling events without having to put boilerplate code in each derived class.