csharp
thom
·
DoTheThing
·
C#
·
Total Size: 755 B
·
·
Created: 6 years ago
·
Edited: 5 years 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
•
971 views
Are you sure you want to delete?