新手提问,请帮忙
我写了三个文件
1、Elevator.cs
using System;
namespace Sams.CSharpPrimerPlus.ElevatorSimulation
{internal class Elevator
{
public static void PrintClassname()
{
Console.WriteLine("中国人");
}
}
}
2、Person.cs
using System;
namespace Sams.CSharpPrimerPlus.ElevatorSimulation
{
public class Person
{
public void Talk()
{Console.WriteLine("俺还是个中国人");}
}
}
3、ElevatorSimulatior.cs
using System;
namespace Sams.CSharpPrimerPlus.ElevatorSimulation
{
public class ElevatorSimulation
{
public static void Main()
{Person pp=new Person();
pp.Talk();
Elevator.PrintClassname();
}
}
}
//三个文件同属同一个名子空间
编译过程如下:
csc /out:Elevator.dll /t:library Elevator.cs
csc /out:Person.dll /t:libary Person.cs
csc /out:ElevatorSimulation.exe /r:Elevator.dll;Person.dll ElevatorSimulator.cs
当执行这句的时候提示如下:
ElevatorSimulator.cs(9,5): error CS0122:
'Sams.CSharpPrimerPlus.ElevatorSimulation.Elevator' is inaccessible due
to its protection level
好像是说Elevator.PrintClassname();这句话错了,请朋友帮忙解决一下,谢谢