Decorator pattern wasting memory
问题 I have this base class having the following interface: abstract class Base { abstract public object Val { get; } } For any derived classes, Val 's value must be specified at object creation time. The question is: How can I make a derived class do this (hopefully at compile time)? I tried adding a constructor: abstract class Base { public Base(object value) { val = value; } private object val; ... } But as you can see then I had to declare a private field to store value in it (because Value is