fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. WoodDuck qua = new WoodDuck();
  14. qua.DuckFly();
  15.  
  16. }
  17. }
  18. interface FlyBehavior {
  19. void fly();
  20. }
  21.  
  22. class FlyWithWings:FlyBehavior {
  23. public void fly() {
  24. Console.WriteLine("I can fly with wings!");
  25. }
  26. }
  27. class FlyWithRockets:FlyBehavior {
  28. public void fly() {
  29. Console.WriteLine("Fly! With Rockets!");
  30. }
  31. }
  32.  
  33. class duck {
  34. }
  35.  
  36. class WoodDuck : duck {
  37. FlyBehavior WFB;
  38. public WoodDuck() {
  39. WFB = new FlyWithWings();
  40. }
  41. public void DuckFly(){
  42. WFB.fly();
  43. }
  44. }
  45. }
  46.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(5,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty