csharp

thom

·

DoTheThing

·

C#

·

Total Size: 755 B

·

·

Created: 7 months ago

·

Edited: 7 months ago

public class DoClass { private Thing MyThing; private Function<void,void> MyThingFunc; public setThing( Thing thing ) { Mything = thing; } public setThing( Function<void,void> thing ) { MyThingFunc = thing; } public DoClass() {} // set thing on object construction public DoClass( Thing thing ) { MyThing = thing; } // use member variable to execute the function in Thing class public void DoMyThing() { MyThing.DoTheThing(); } // or pass in an instance of Thing public void DoMyThing( Thing thing ) { thing.DoTheThing(); } public void DoMyThingDirectly() { MyThingFunc(); } }

1 bit

154 views

Are you sure you want to delete?