How to increase the access modifier of a property

前端 未结 3 1944
面向向阳花
面向向阳花 2021-01-04 18:17

I\'m trying to create a set of classes where a common ancestor is responsible for all the logic involved in setting various properties, and the descendants just change the a

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-04 18:51

    NO. Still you can Hide the inherited property with Your's

    public class ChildTwo: Praent { 
        public new int PropertyTwo { 
           // do whatever you want
        }
    }
    

    ps: this is no longer virtual/override relationship (i.e. no polymorphic calls)

提交回复
热议问题