There's no way I know of to write the class so the compiler enforces it. If there was I bet we would see it when making COM callable managed types. They need a parameterless ctor too but rely on documentation. :)
Jim > -----Original Message----- > From: Shawn Wildermuth [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 07, 2002 1:31 PM > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] Confusion about the Type system... > > > Again, how do I require a parameterless ctor? This isn't legal is C#: > > class Foo > { > abstract Foo(); > } > > That is essentially what I want. Unfortunatley, ctor's are > not part of > the interface of a class so I cannot require that inherited classes > create ctors in a particular way. > > Thanks, > > Shawn Wildermuth > [EMAIL PROTECTED] > > > -----Original Message----- > > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > > On Behalf Of Brad Wilson > > Sent: Tuesday, May 07, 2002 10:39 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [DOTNET] Confusion about the Type system... > > > > > > Shawn Wildermuth wrote: > > > > > 1. Specify in my base class that a constructor style is > > required (like > > > marking it abstract, but C# doesn't support this of course) .or. > > > 2. Create objects of the Type of my base class and at > > runtime, up-cast > > > them to the new type. > > > > As ugly as it sounds, I would say that you should use a > > parameter-less constructor and then mandate an Init function, > > and use two-step creation. This at least will be legal in all > > languages, even if it is a tad on the less-desirable side. > > > > Brad > > > > -- > > Read my web log at http://www.quality.nu/dotnetguy/ > > > > You can read messages from the DOTNET archive, unsubscribe > > from DOTNET, or subscribe to other DevelopMentor lists at > > http://discuss.develop.com. > > > > You can read messages from the DOTNET archive, unsubscribe > from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.