why we need to call parent constructor in the child one

seco

Well-known member
Joined
Mar 4, 2007
Messages
66
Programming Experience
Beginner
hi

why we need to call parent constructor by calling mybase.new() in the child constructor?
 
because it needs to be called to create the object.

Everything you write in VB, inherits from Object. Object has a default constructor that must be called. If you put no constructor in your class, VB adds one silently and hidden, when it compiles, and it simply calls MyBase.New


If you add your own constructor, you must still call Object's constructor to have your object created. Its a rule of the language..
 
Back
Top