Created
May 12, 2011 14:25
-
-
Save driscollwebdev/968590 to your computer and use it in GitHub Desktop.
Facade Implementation
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
public class MyClassFoo | |
{ | |
public string Foo { get; set; } | |
public MyClassFoo(string foo) | |
{ | |
Foo = foo; | |
} | |
public string DoSomethingWithFoo() | |
{ | |
return String.Format("Foo says: {0}",Foo); | |
} | |
} | |
public class MyClassBar | |
{ | |
public string Bar { get; set; } | |
public MyClassBar(string bar) | |
{ | |
Bar = bar; | |
} | |
public string DoSomethingWithBar() | |
{ | |
return String.Format("Bar says: {0}",Bar); | |
} | |
} | |
public class MyFacade | |
{ | |
private MyClassFoo foo; | |
private MyClassBar bar; | |
public MyFacade() | |
{ | |
foo = new MyClassFoo("Hi, I'm Foo!"); | |
bar = new MyClassBar("Hi, I'm Bar!"); | |
} | |
public string DoSomethingWithFooAndBar() | |
{ | |
return String.Format("{0}{1}{2}",foo.DoSomethingWithFoo(),Environment.Newline,bar.DoSomethingWithBar()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment