Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- D *d = new Adapter();
- d->foo();
- class C { /* ... */ public: int foo (); int bar (); };
- class D /* ... */ { public: int foo (); };
- public class C
- {
- public void foo()
- {
- }
- public void bar()
- {
- }
- }
- public class D
- {
- public void foo()
- {
- }
- }
- public interface FooExecutor
- {
- void foo();
- }
- public class CExecutor : FooExecutor
- {
- C cMember;
- public CExecutor (C c)
- {
- cMember = c;
- }
- public void foo()
- {
- cMember.foo();
- }
- }
- public class DExecutor : FooExecutor
- {
- D dMember;
- public DExecutor (D d)
- {
- dMember = d;
- }
- public void foo()
- {
- dMember.foo();
- }
- }
- List<FooExecutor> myList = new List<FooExecutor>();
- myList.Add(new CExecutor(new C());
- myList.Add(new DExecutor(new D());
- foreach (FooExecutor f in myList)
- {
- f.foo();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement