Is there a way to reach a `protected` member of another object from a derived type?

后端 未结 7 1174
轻奢々
轻奢々 2020-11-30 13:41
class MyBase
{
    protected object PropertyOfBase { get; set; }
}

class MyType : MyBase
{
    void MyMethod(MyBase parameter)
    {
        // I am looking for:
           


        
7条回答
  •  难免孤独
    2020-11-30 14:17

    I think you should ask yourself if there is a better way of doing what you want to do. You want PropertyOfBase to act as public in the context of MyType.MyMethod(), but to be protected in all other situations. Why?

提交回复
热议问题