Last active
April 10, 2020 15:23
-
-
Save mauricereeves/99c5861c59e895ac94421500ac69ec7f to your computer and use it in GitHub Desktop.
Sample Interview Question 1
This file contains 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
/* | |
For an article on Medium about the right and wrong way to conduct | |
interview questions. This is in no way an example of how I think | |
something should be done. This is bad. Don't do this! Why would | |
you do this? | |
*/ | |
using System; | |
public class Main | |
{ | |
public class Foo | |
{ | |
public int Value = 42; | |
public string DoThis() => "A: DoThis!"; | |
public string DoThat() => "A: DoThat!"; | |
} | |
public class Bar: Foo | |
{ | |
int Value = 0; | |
public new string DoThis() => "B: DoThis!"; | |
public new string DoThat() => "B: DoThat!"; | |
} | |
public static void Main(string[] args) | |
{ | |
var myBar = new Bar(); | |
Foo myFoo = new Bar(); | |
// what does this line print out? | |
Console.WriteLine($"{myBar.value} - {myBar.DoThis()} {myBar.DoThat()}"); | |
// what does this line print out? | |
Console.WriteLine($"{myFoo.value} - {myFoo.DoThis()} {myFoo.DoThat()}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment