[Mono-list] MCS can't handle private access scope?
daniel@solin.org
daniel@solin.org
Thu, 23 Jan 2003 00:53:47 -0800
Hi again,
Okay, I added a note to bugzilla. Bug# is 37111. Hope this helps.
Thx,
Dan
On Thu, Jan 23, 2003 at 12:30:01AM -0800, Jackson Harper wrote:
>
> This is basically the same problem and my patch fixes this also. Making
> a note in bugzilla would be helpful though.
>
> Thanks,
>
> Jackson
>
>
>
> On Wed, 2003-01-22 at 23:16, daniel@solin.org wrote:
> > Hi again,
> >
> > Think I found another access-scope-related bug. Please take a look
> > at the following:
> >
> > 1. Create calculator.cs:
> > namespace Calculator
> > {
> > class MyCalculator
> > {
> > private Validator va = new Validator();
> >
> > public int add(int val1, int val2)
> > {
> > if(va.validate(val1) && va.validate(val2))
> > return (val1+val2);
> > else
> > return 0;
> > }
> >
> > private class Validator
> > {
> > public bool validate(int val)
> > {
> > if(val<0)
> > return false;
> > else
> > return true;
> > }
> > }
> > }
> > }
> >
> > 2. Compilte calculator.cs into a dll:
> > daniel@localhost:~$ mcs /t:library calculator.cs
> >
> > 3. Create myclass.cs:
> > using System;
> > using Calculator;
> >
> > class MyClass
> > {
> > public static void Main(string[] args)
> > {
> > MyCalculator.Validator v = new MyCalculator.Validator();
> > }
> > }
> >
> > 4. Compile myclass.cs:
> > daniel@localhost:~$ mcs /r:./calculator.dll myclass.cs
> >
> > 5. This compiles fine, but since we're trying to access the private
> > class Validator from myclass.cs, I think this should generate an error.
> > The MS compiler gives me the following:
> >
> > C:\temp>csc /r:./calculator.dll myclass.cs
> > Microsoft (R) Visual C# .NET Compiler version 7.00.9466
> > for Microsoft (R) .NET Framework version 1.0.3705
> > Copyright (C) Microsoft Corporation 2001. All rights reserved.
> >
> > myclass.cs(8,9): error CS0122: 'Calculator.MyCalculator' is inaccessible due to its protection level
> >
> >
> > Shall I do a bugzilla about this?
> >
> > Thx,
> > Dan
> > _______________________________________________
> > Mono-list maillist - Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
>