// CS1540.cs
public class Base
{
protected void MethodA()
{
}
}
public class Derived : Base
{
public static void test(Base anotherInstance)
// FIX #1: Change the method declaration as follows
// public static void test(Derived anotherInstance)
{
anotherInstance.MethodA(); // CS1540
}
}
public class Tester : Derived
{
public static void Main()
{
Base myBaseClass = new Base();
// FIX #2: Change the new object creation as follows
// Derived myBaseClass = new Derived();
test(myBaseClass);
}
}