fork(2) download
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. Vehicle drone = new Drone();
  6. Vehicle archer = new Archer();
  7. drone.DisplayInfo();
  8. archer.DisplayInfo();
  9. Console.ReadKey();
  10. }
  11. }
  12. class Vehicle
  13. {
  14. public string Name { get; set; }
  15. public string Weapon { get; set; }
  16. public int PowerScore { get; set; }
  17. public int EngenePower { get; set; }
  18. public int VehicleId { get; set; }
  19. public Vehicle()
  20. { }
  21. public virtual void DisplayInfo() { }
  22.  
  23. }
  24. class Drone : Vehicle
  25. {
  26. public Drone(string name, int vehicleId, string weapon, int powerScore, int engenePower)
  27. {
  28. VehicleId = 001;Name = "Droncarrier";PowerScore = 5000;Weapon = "drone Fuse";EngenePower = 540;
  29. }
  30. public override void DisplayInfo()
  31. {
  32. Console.WriteLine(VehicleId + " with " + Name + " has " + PowerScore + " and carrys weapon " + Weapon + " engine " + EngenePower);
  33. }
  34. }
  35. class Archer : Vehicle
  36. {
  37. public Archer(string name, int vehicleId, string weapon, int powerScore, int engenePower)
  38. {
  39. VehicleId = 003;Name = "Miniarcher";PowerScore = 5000;Weapon = "crossbow";EngenePower = 430;
  40. }
  41. public override void DisplayInfo()
  42. {
  43. Console.WriteLine(VehicleId + " with " + Name + " has " + PowerScore + " and carrys weapon " + Weapon + " engine " + EngenePower);
  44. }
  45. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(5,25): error CS1729: The type `Drone' does not contain a constructor that takes `0' arguments
prog.cs(26,12): (Location of the symbol related to previous error)
prog.cs(6,26): error CS1729: The type `Archer' does not contain a constructor that takes `0' arguments
prog.cs(37,12): (Location of the symbol related to previous error)
prog.cs(9,9): error CS0103: The name `Console' does not exist in the current context
prog.cs(32,7): error CS0103: The name `Console' does not exist in the current context
prog.cs(43,9): error CS0103: The name `Console' does not exist in the current context
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty