Skip to content

Instantly share code, notes, and snippets.

@slimbo
Created November 7, 2012 02:58
Show Gist options
  • Select an option

  • Save slimbo/4029336 to your computer and use it in GitHub Desktop.

Select an option

Save slimbo/4029336 to your computer and use it in GitHub Desktop.
Hit the Bits! - Light Switch
class LightSwitch
{
// PUBLIC STUFF PRIVATE STUFF
// ---------------------------- ------------------------------------------------
private Wire inboundWire, outboundWire;
private bool isOn;
public void turnOn()
{
connectWires();
isOn = true;
}
public void turnOff()
{
disconnectWires();
isOn = false;
}
private void connectWires()
{
inboundWire.connectTo(outboundWire);
}
private void disconnectWires()
{
inboundWire.disconnectFrom(outboundWire);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment