I have a superclass which has a bunch of variables. e.g.
string s1= ''; string s2= ''; string s3= '';
…etc
I’d like to guarantee that these variables get overridden (assigned something useful) in the subclass that inherits from this superclass, at compile time.
is there an elegent way of doing this?
Make all the constructors in the base class take them as parameters, and set them from those constructors:
…
Hopefully they’re private fields anyway, so the derived class couldn’t set them directly anyway, right? 🙂