c# - Virtual method being called using base -
in regards virtual method:
protected internal virtual void populategetparameters( int id, list<sqlparameter> parameters) { } which being overridden in class inheriting base class. confusing me overriding method calling the virtual method?
protected override void populategetparameters( int id, list<sqlparameter> parameters) { base.populategetparameters(id, parameters); parameters.add(new sqlparameter(this.keyparamname, id)); } seeing virtual methods meant overridden. purpose of calling base.populategetparameters(id, parameters);? can't find out implementation happening base.populategetparameters empty virtual method , override calls reason.
the virtual keyword used allow method overridden.
in c#, default, methods non-virtual , cannot override non-virtual method. opposite of java, methods virtual default.
in case, calling base implementation of method, nothing because it's empty. anyway it's fine call , it's common.
you can find more informations here.
Comments
Post a Comment