Modifying parameter values before sending to Base constructor

前端 未结 7 511
借酒劲吻你
借酒劲吻你 2021-01-07 16:26

The title may be a bit ambiguous, but I couldn\'t think of a better way to word this.

I realize that I can not call a derived constructor prior to calling a base con

7条回答
  •  迷失自我
    2021-01-07 17:00

    Yes. It's fine to use normal expressions, which don't access the instance, in order to manipulate the value. For instance

    public DerivedClass(int i)
        : base((InputType)i)
    {
    }
    

提交回复
热议问题