Created
March 21, 2011 19:49
-
-
Save larsw/880073 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Runtime.InteropServices; | |
// | |
// Quiz: how can you get this to compile / run / output "Hello World", by only adding three attributes? | |
// | |
// Lars Wilhelmsen / @larsw | |
// | |
namespace InterfaceInstances | |
{ | |
public interface IFoo | |
{ | |
void SayHello(); | |
} | |
public class Foo : IFoo | |
{ | |
public void SayHello() | |
{ | |
Console.WriteLine("Hello World"); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var foo = new IFoo(); | |
foo.SayHello(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment