fork download
using System;

public abstract class MenuItem
    protected string m_Title;

public class ContainerItem : MenuItem
    void Foo()
        var derivedItem = new ContainerItem();
        derivedItem.m_Title = "test"; // works fine

        var baseItem = (MenuItem)derivedItem;
        baseItem.m_Title = "test"; // compiler error!
Compilation error #stdin compilation error #stdout 0s 0KB
Standard input is empty
compilation info
prog.cs(16,18): error CS1540: Cannot access protected member `MenuItem.m_Title' via a qualifier of type `MenuItem'. The qualifier must be of type `ContainerItem' or derived from it
prog.cs(5,22): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Standard output is empty