Advertisement
Guest User

Untitled

a guest
Mar 26th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public class køretøj
  2. {
  3. public int AntalHjul { get; set; }
  4.  
  5. public void SigLyd()
  6. {
  7.  
  8. }
  9.  
  10. }
  11.  
  12.  
  13. public class Toyota : køretøj, IBouncer,IForanTræk
  14. {
  15. public void bounce()
  16. {
  17. }
  18.  
  19. public void Træk(bool Fremad)
  20. {
  21. }
  22. }
  23.  
  24. public class Ford : køretøj,IBouncer
  25. {
  26.  
  27.  
  28.  
  29. public void bounce() { }
  30.  
  31. }
  32. public class Subaru : køretøj,IBouncer
  33. {
  34. public void bounce() { }
  35.  
  36.  
  37. }
  38. interface IBouncer
  39. {
  40. void bounce();
  41.  
  42. }
  43.  
  44. interface IForanTræk
  45. {
  46. void Træk(bool Fremad);
  47. }
  48.  
  49. class Program
  50. {
  51.  
  52.  
  53.  
  54. static void Main(string[] args)
  55. {
  56. List<køretøj> vehicles = new List<køretøj>();
  57. vehicles.Add(new Toyota());
  58. vehicles.Add(new Subaru());
  59. vehicles.Add(new Ford());
  60.  
  61.  
  62. List<IBouncer> bouncyKøretøjer = new List<IBouncer>();
  63. foreach (køretøj item in vehicles)
  64. {
  65.  
  66. }
  67.  
  68. System.Console.WriteLine(vehicles[0].AntalHjul);
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement