I understand overriding a method/function redefines its implementation in the derived class from its implementation in the base class.
Now what confuses me, is if I override a class in ASP.NET such as CreateChildControls()
(I picked it randomly for no particular reason), VS2008 auto generates:
protected override void CreateChildControls()
{
base.CreateChildControls();
}
Good enough, the default implementation just calls the base class' CreateChildControls()
.
So if I want to run some code, since I do not know how base.CreateChildControls()
, should I do this:
protected override void CreateChildControls()
{
/*My Code Here*/
base.CreateChildControls();
}
or, ignore what base.CreateChildControls()
altogether and just do
protected override void CreateChildControls()
{
/*My Code Here*/
}