Skip to content

Instantly share code, notes, and snippets.

@JasonBock
Created May 12, 2022 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasonBock/1460a4c73e67002b71a667df8927e65e to your computer and use it in GitHub Desktop.
Save JasonBock/1460a4c73e67002b71a667df8927e65e to your computer and use it in GitHub Desktop.
public abstract class Driver
{
protected Driver() { }
public abstract void Drive();
public virtual void Stop() { }
}
public sealed class GolferDriver
: Driver
{
public override void Drive()
{
var value = RandomNumberGenerator.GetInt32(100, 150);
Console.WriteLine($"Club head speed: {value} MPH");
}
public override void Stop()
{
base.Stop();
var value = RandomNumberGenerator.GetInt32(250, 320);
Console.WriteLine($"{value} yards");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment