Advertisement
karlakmkj

Implementing Interface 3

Nov 24th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. //Test interface at Main method
  2. using System;
  3.  
  4. namespace LearnInterfaces
  5. {
  6.   class Program
  7.   {
  8.     static void Main(string[] args)
  9.     {
  10.       Sedan s1 = new Sedan(60);
  11.       Sedan s2 = new Sedan(70);
  12.       Truck t1 = new Truck(45, 500);
  13.  
  14.       Console.WriteLine($"The first sedan's speed is: {s1.Speed}, wheels is {s1.Wheels}, and License plate is {s1.LicensePlate}");
  15.  
  16.       Console.WriteLine($"The second sedan's speed is: {s2.Speed}, wheels is {s2.Wheels}, and License plate is {s2.LicensePlate}");
  17.  
  18.       Console.WriteLine($"The truck's speed is: {t1.Speed}, wheels is {t1.Wheels}, and License plate is {t1.LicensePlate}");
  19.  
  20.       //call method
  21.       s1.SpeedUp();
  22.       s2.SpeedUp();
  23.       t1.SpeedUp();
  24.  
  25.       Console.WriteLine($"Now the first sedan speed is {s1.Speed}");
  26.       Console.WriteLine($"Now the second sedan speed is {s2.Speed}");
  27.       Console.WriteLine($"Now the truck speed is {t1.Speed}");
  28.     }
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement