Skip to content

Instantly share code, notes, and snippets.

@PoisonousJohn
Created February 20, 2018 16:34
Show Gist options
  • Save PoisonousJohn/ecf3b395da35433a4fed678b2889f26f to your computer and use it in GitHub Desktop.
Save PoisonousJohn/ecf3b395da35433a4fed678b2889f26f to your computer and use it in GitHub Desktop.
Offline emulation using virtual methods
public class APIService {
public virtual string UserId {
get {
return _userId;
}
}
public virtual void Login()
{
// send request to server here
}
private string _userId;
}
public class OfflineAPIService : APIService {
public override string UserId {
get {
return "offlineUser";
}
}
public override void Login()
{
// do nothing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment