I have this base class with the following interface:
abstract class Base
{
abstract public object Val
{
get;
}
}
For any derived classes, the Valvalue must be specified at the time the object is created.
The question is: how can I make a derived class do this (hopefully at compile time)?
I tried to add a constructor:
abstract class Base
{
public Base(object value)
{
val = value;
}
private object val;
...
}
, , ( ).
- , - Decorator/Wrapper, GoF. , , .