[Mono-list] Constructors in C#
Michal Moskal
malekith@pld-linux.org
Sat, 20 Nov 2004 11:05:58 +0100
On Fri, Nov 19, 2004 at 08:36:32PM +0100, Brice Carpentier wrote:
> Joe Audette wrote:
> >ok,
> >
> >How about this:
> >
> >public class MyClass
> >{
> > private string member;
> > public MyClass ()
> > {
> > DoStuff("stuff");
> > }
> > public MyClass (String s)
> > {
> > DoStuff(s);
> > }
> >
> > private void DoStuff(string s)
> > {
> > this.member = s;
> >
> > }
> >}
> >
> >Joe
> I thought about this too, but I don't find it really clean, without
> having concret arguments against it.
Of course there are -- what if member is readonly?
As for VB -- I don't see anything that cannot be done in C# there. You
don't call one ctor from another.
--
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?