Pastaba
Prieigai prie šio puslapio reikalingas įgaliojimas. Galite bandyti prisijungti arba pakeisti katalogus.
Prieigai prie šio puslapio reikalingas įgaliojimas. Galite bandyti pakeisti katalogus.
'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended.
A member was declared with the same name as a member in a base class. However, the new modifier was not used.
The following sample generates CS0108. You can resolve CS0108 in one of two ways:
Rename the member in the derived class if member hiding was not intended.
Use the
new
modifier to declare that the derived member hiding of the base member was intentional.
// CS0108.cs
// compile with: /W:2
using System;
namespace MyNamespace;
public class BaseClass
{
public int i = 1;
}
public class DerivedClass : BaseClass
{
public static int i = 2; // CS0108
// Use the following line instead:
// public static new int i = 2;
public static void Main()
{
Console.WriteLine(i);
}
}