rshishir11

Classtest Set A Qn4

Jun 28th, 2022 (edited)
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None
  1. using System;
  2.  
  3. namespace Example
  4. {
  5.   // Abstract class
  6.   abstract class Fmachine
  7.   {
  8.     public abstract void getData(string code, string name, int capacity);
  9.     public abstract void putData();
  10.   }
  11.  
  12.  
  13.   class Airplane : Fmachine
  14.   {
  15.     private string code;
  16.     private string name;
  17.     private int capacity;
  18.    
  19.     public override void getData(string code, string name, int capacity)
  20.     {
  21.       this.code = code;
  22.       this.name = name;
  23.       this.capacity = capacity;
  24.     }
  25.    
  26.     public override void putData()
  27.     {
  28.       Console.WriteLine($"Code : {code} \nName : {name} \nCapacity : {capacity}");
  29.     }
  30.   }
  31.  
  32.   class Program
  33.   {
  34.     static void Main(string[] args)
  35.     {
  36.       Airplane a = new Airplane();
  37.       a.getData("AAx12V","Qatar Airways", 5000);
  38.       a.putData();
  39.     }
  40.   }
  41. }
RAW Paste Data Copied