c# - When inheriting from a framework control, should I call the base constructor? -


i'm inheriting listbox. need explicitly call base constructor?

public class mylistbox : listbox {    public mylistbox() : base()    {    }     // or      public mylistbox()    {    } } 

the 2 options listed compile identical code.

the reason include : base() explicitly denote calling base classes default constructor instead of other constructor, design. if left off, happens automatically. such, optional.

however, if want use constructor other parameterless constructor of base class, have explicitly state this, ie:

public mylistbox() : base("foo") { } 

this explicitly use constructor accepted string argument.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -