I have a class with some virtual functions, let's say this is one of them:
public class AClassWhatever { protected virtual string DoAThingToAString(string inputString) { return inputString + "blah"; } }
I want to instantiate this class by overriding the built-in string "DoathingToAString", how can I declare the inline properties in the declaration as follows:
... AClassWhatever instance = new AClassWhatever { DoAThingToAString = new function(string inputString) { return inputString + inputString + " fill my eyes." } } ...
And now for the "instance", DoThingToAString is overridden by this definition. I need to be able to define the default behavior in the class definition and only redefine it as needed, at different times, and I do not want to propagate a bunch of subclasses to do this.
I know that I need to use delegates or something like that, but I have been away from the syntax game for too long and Google has given me too much irrelevant information.
kamii
source share