fork(1) download
  1. public abstract class Car
  2. {
  3.  
  4. protected double x = 10;
  5. protected double y = 10;
  6. private string Gas = string.empty;
  7. protected Car(){ }
  8.  
  9. protected Car(double x, double y,string strGas)
  10.  
  11. {
  12.  
  13. this.x = x;
  14. this.y = y;
  15. this.Gas = strGas;
  16.  
  17. }
  18.  
  19. public abstract int Speed();
  20.  
  21. }
  22.  
  23.  
  24.  
  25.  
  26. public class TOYOTA : Car
  27. {
  28. public TOYOTA(){ }
  29. public override int Speed()
  30. {
  31. return x * y;
  32. }
  33. }
  34.  
  35.  
  36.  
  37. public class HONDA : Car
  38. {
  39.  
  40. public HONDA(double x, double y): base(x, y)
  41. {
  42.  
  43. }
  44.  
  45. public override int Speed()
  46. {
  47. return x * y;
  48. }
  49. }
  50.  
  51. static void Main(string[] args)
  52. {
  53. TOYOTA T = new TOYOTA();
  54. int nToyotaSpeed = T.Speed();
  55.  
  56. HONDA H = new HONDA(10,5);
  57. iny nHondaSpeed = H.Speed();
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(51,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
prog.cs(51,24): warning CS0658: `]' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(58,1): error CS8025: Parsing error
Compilation failed: 2 error(s), 1 warnings
stdout
Standard output is empty