lundi 19 octobre 2020

C# - Overriding inheritance pattern [duplicate]

In a third party project I have stumbled upon a C# code pattern that is unknown to me, and which I wasn't able to find anything about online, though the code compiles just fine. I have added comments to these two lines I do not get:

public class SimulationSceneContext: BaseSceneContext, ISceneContext {
    
    protected override string backgroundLayerName => "SimulationBackground";    // is that a lambda override?

    public SimulationSceneContext(SimulationData data): base(data) {}    // what kind of constructor is that??
}

Base class:

public abstract class BaseSceneContext {
    
    protected abstract string backgroundLayerName { get; }

    public BaseSceneContext(SimulationData data) 
    {
        // ...
    }

    // ...
}

I was unsure as to how to phrase this question, if anyone has a suggestion for a better title I am happy to rename it, so that others stumbleing on such a pattern are able to find it.

Aucun commentaire:

Enregistrer un commentaire