C#C
C#3y ago
Solace

❔ ✅ abstract-Parent and Child static overrides?

How do I redeclare an objects element which needs be from a static context in a child class?

I have an abstract parent class:
public abstract class ResizableGatePrefab : PrefabVariantInfo {
        //more things above
        private static Color24 color_t = new Color24(0,0,0);
        public Block prefabBlock = new Block { RawColor = color_t };
        //more things below
}

and some child classes (here's an example):
public class ResizableAndGatePrefab : ResizableGatePrefab {
        public static Color24 color_t = new Color24(127,127,127);
        public Block prefabBlock = new Block { RawColor = color_t };
        //more things below
}

where in I'm trying to override prefabBlock and want to give it a color RawColor; RawColor requires it's Color24 be static. I have been struggling with this massively.
Was this page helpful?