[Mono-list] Bug in 0.17: Classes should be internal by default, not public
jpo
jpo234@netscape.net
Sun, 05 Jan 2003 10:39:13 +0100
Hi list,
it seems that classes without an access specifier are public in mcs. I
think this
is wrong.
A demonstration:
// file namespace1.cs
using System;
namespace de.condat.csharp {
class Foo {
public Foo ()
{
Console.Out.WriteLine ("Foo angelegt");
}
}
}
// file namespace2.cs
using System;
namespace de.condat.csharp1 {
class Foo {
public Foo ()
{
Console.Out.WriteLine ("Foo1 angelegt");
}
}
}
//file namespace.cs
using System;
using n1 = de.condat.csharp;
using n2 = de.condat.csharp1;
struct Tester {
public static void Main () {
n1.Foo f = new n1.Foo ();
n2.Foo b = new n2.Foo ();
}
}
Compiling with mcs :
$mcs /t:library namespace1.cs namespace2.cs
Compilation succeeded
$mcs /r:namespace1.dll namespace.cs
Compilation succeeded
$mono namespace.exe
Foo angelegt
Foo1 angelegt
Compiling with csc:
F:\namespace>csc /t:library namespace1.cs namespace2.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.
F:\namespace>csc namespace.cs /r:namespace1.dll
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.
namespace.cs(7,3): error CS0122: 'de.condat.csharp.Foo' is inaccessible
due to
its protection level
namespace.cs(8,3): error CS0122: 'de.condat.csharp1.Foo' is inaccessible
due to
its protection level