|
-
Sep 27th, 2005, 09:39 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
I can't remember what keyword is needed to force people to call the parent's New. Any help would be appreciated!
-
Sep 27th, 2005, 12:18 PM
#2
Thread Starter
Fanatic Member
Re: What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
Or am I just crazy and there is nothing out there that does this?
-
Sep 27th, 2005, 12:20 PM
#3
Re: What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
Um, in the child class constructor, it would be mybase.new....
-tg
-
Sep 27th, 2005, 01:13 PM
#4
Re: What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
If the base class has no default constuctor (parameterless) then the subclass is required to call the parameterized constructor.
-
Sep 27th, 2005, 02:00 PM
#5
Thread Starter
Fanatic Member
Re: What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
Well, this is what I'm asking. My base class has a Sub New(), and I have code in it that I want to run no matter what class inherits it. Now, I know the child class can call MyBase.New() in its constructor, but VB.NET doesn't force this. Is there a way to force the child class to always call MyBase.New() when it inherits from that base class?
-
Sep 27th, 2005, 02:04 PM
#6
Thread Starter
Fanatic Member
Re: What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
Nevermind... It looks like MyBase.New() automatically gets called due to the Inherits keyword. I guess programmers don't need to explicitly call that function in order for it to run.
-
Sep 27th, 2005, 02:06 PM
#7
Re: [RESOLVED] What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
I dunno... when ever I create a new form, I always see a MyBase.New() called in there.... even though it Inherits Windows.Form.....
-tg
-
Sep 27th, 2005, 02:08 PM
#8
Thread Starter
Fanatic Member
Re: [RESOLVED] What Keyword is needed in a base class to FORCE child classes to call Mybase.New()?
Well, I think C# requires that, but VB.NET doesn't. Of course, I'm also using VB .Net 2005 August CTP...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|