c# - Does the New keyword call an inherited object's function? -
in c#, if have object inherits object, , inherited object has function same name base object, if want call base object's function when inherited object's function called, should use new keyword? if not, how best way call both functions?
here example:
public partial class formtest : form { public new void refresh() { testfunction(); } }
basically, asking if refresh
function of form
object called when refresh
function of formtest
object called. also, refresh
function of form
object called first, or called after refresh
function of formtest
object.
using new
keyword indicate explicit base class method refresh
should hidden. refresh
method of base class not called in case. in order call base class method use base.refresh()
in refresh
method of formtest
class.
Comments
Post a Comment