﻿<?xml version="1.0" encoding="utf-8"?>
<ErrorDocumentation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ErrorName>CS1540</ErrorName>
  <Examples>
    <string>// cs1540-2.cs : Cannot access protected member `A.X()' via a qualifier of type `B'; the qualifier must be of type `C' (or derived from it)
// Line: 21

class A
{
        protected virtual void X ()
        {
        }
}
 
class B : A
{
}
 
class C : A
{
        static B b = new B ();
 
        static void M ()
        {
                b.X ();
        }
}</string>
    <string>// cs1540.cs: Cannot access protected member `A.n' via a qualifier of type `B'; the qualifier must be of type `C' (or derived from it)
// Line: 19

class A
{
        protected int n;
}
 
class B : A
{
}
 
class C : A
{
        static B b = new B ();
 
        static void Main ()
        {
                b.n = 1;
        }
}
</string>
    <string>// cs1540-4.cs: Cannot access protected member `A.n()' via a qualifier of type `A'; the qualifier must be of type `B' (or derived from it)
// Line: 14

class A
{
        protected void n () { }
}

class B : A
{
        public static void Main ()
	{
		A b = new A ();
		b.n ();
	}
}



</string>
    <string>// cs1540.cs: Cannot access protected member `A.n' via a qualifier of type `B'; the qualifier must be of type `C.N' (or derived from it)
// Line: 12

class A {
	protected int n = 0;
}

class B : A { }

class C : B {
	class N {
		static internal int foo (B b) { return b.n; }
	}
	public static int Main () {
		return N.foo (new B ());
	}
}
</string>
    <string>// cs1540-6.cs: Cannot access protected member `A.A(A)' via a qualifier of type `A'; the qualifier must be of type `B' (or derived from it)
// Line: 25

public class A {
	public A ()
	{
	}

	protected A (A a)
	{
	}
}

public class B : A {
	public B () : base ()
	{
	}
	
	public B (A a) : base (a)
	{
	}
	
	public A MyA {
		get {
			A a = new A (this);
			return a;
		}
	}
}
</string>
    <string>// cs1540-7.cs: Cannot access protected member `A.Test' via a qualifier of type `B'; the qualifier must be of type `C' (or derived from it)
// Line: 17

class A
{
    protected object[] Test { get { return null; } }
}

class B : A
{
}

class C: A
{
    public void Test2 (B b)
    {
        foreach (object o in b.Test)
        {
        }
    }

}
</string>
    <string>// cs1540-8.cs: Cannot access protected member `A.f' via a qualifier of type `A'; the qualifier must be of type `B' (or derived from it)
// Line: 9

class A {
	protected int f { get { return 1; } }
}

class B : A {
         int baz () { return new A().f; }
   }
 
</string>
    <string>// cs1540.cs: Cannot access protected member `A.n' via a qualifier of type `A'; the qualifier must be of type `B' (or derived from it)
// Line: 14

class A
{
    protected int n;
}

class B : A
{
    public static void Main ()
	{
		A b = new A ();
		b.n = 1;
	}
}
</string>
  </Examples>
</ErrorDocumentation>