1

私は、 構成とデータベース エントリを検索することによって多くの重要なことを行う public を持つエンティティ フレームワークを使用しており、このコードはサードパーティからのものであるため、編集できませんParentClass。ただし、アクセスできないfunctionホワイトリストの情報に「検索」を追加したいと考えています。functionParentClass

以下のコードは、何が起こっているかのモックアップです。ParentClassを拡張してアクセスするためのより良い方法はありますかfunction

public ParentClass : ClassInterface
{
    foo bar;
    public Parent(foo _bar) 
    {
        this.bar = _bar
    }

    function(int) 
    {
        // do things with this.bar
    }
}

public ChildClass : ParentClass, ClassInterface 
{
    public ChildClass(foo _bar) : base(_bar) { }


    public virtual function(int) 
    {
        bool x = base.function(int)
        if (!x) 
        {
            ... stuff
        }

        ... otherstuff
    }
}
4

1 に答える 1