[Mono-devel-list] Possible bug in mono C# compiler

A Rafael D Teixeira rafaelteixeirabr at hotmail.com
Mon Apr 26 11:50:22 EDT 2004


Yes it is a bug, only public or protected constructors can be called from a 
subclass constructor. It only seems like perhaps this bug already in 
buzilla, please check and add it if not.

To correct your code just makes the class1 constructor protected, instead of 
private.

Thanks,

Rafael "Monoman" Teixeira
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
MonoBrasil Founding Member - Membro Fundador do MonoBrasil 
http://monobrasil.softwarelivre.org
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/



>From: "Sanjay Gupta" <GSanjay at novell.com>
>To: <mono-devel-list at lists.ximian.com>
>Subject: [Mono-devel-list] Possible bug in mono C# compiler
>Date: Sun, 25 Apr 2004 11:42:17 -0600
>
>Hi List,
>I have mcs compiler version 0.31.99.0.
>I have a private constructor in base class and in derived class
>the private constructor just calls the base class constructor.
>For Ex:
>
>public abstract class class1 : ISerializable
>{
>                 private class1(SerializationInfo info, StreamingContext
>context)
>	{
>		//do something
>	}
>
>                //more methods
>}
>
>
>public sealed class class2 : class1
>{
>                 private class2(SerializationInfo info, StreamingContext
>context)  : base(info, context)
>	{
>	}
>                //more methods
>}
>
>The above code compiles with mcs but fails on MS .Net giving Compiler
>Error CS0122.
>Is this a bug???
>
>Regards,
>Sanjay
>
>_______________________________________________
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-devel-list

_________________________________________________________________
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br




More information about the Mono-devel-list mailing list