Why can't a member method be passed to a base class constructor?

后端 未结 7 1766
谎友^
谎友^ 2021-01-07 17:10
class Flarg
{
    private readonly Action speak;

    public Action Speak
    {
        get
        {
            return speak;
        }
    }

    public Flarg(Act         


        
7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-07 17:46

    Only static fields could be passed to the base constructor. The object is not yet initialized so you cannot use instance members. If you make the GiveDumbLook static it will work.

提交回复
热议问题