Re: Why must the designer create an instance of my control's absract base class?
Andy Langowitz <[email protected]> Thu, 25 Oct 2007 10:23:37 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
On Wed, 24 Oct 2007 21:32:31 +0200, Brady Kelly <[email protected]> wrote: >I'm not asking it to create an instance of the base class, just the derive >class. Can anyone tell me why this is so? I have also been annoyed at this behavior, which means you cannot extend an abstract class when writing a designer-supported object, so I have thought about it in the past. Here's a possible explanation (I'm not a MS person, so I'm making an educated guess): The designer is responsible for generating code (in the InitializeComponents method) that is called from your class's constructor. Hence, it cannot invoke your class's constructor until it has completed its code generation (which came first, the chicken or the egg?). However, it needs to find out things about the class (such as its superclass public properties), so that is presumably why it invokes a constructor on the base class. Does this make sense? Andy Langowitz