Created
February 20, 2018 16:34
-
-
Save PoisonousJohn/ecf3b395da35433a4fed678b2889f26f to your computer and use it in GitHub Desktop.
Offline emulation using virtual methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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