static void Main(string[] args) { CongNhan cn1 = new CongNhan(); cn1.nhap(); cn1.xuat(); }
public void Nhap(CanBo[] canBos, int n) { string x; for (int i = 0; i < n; i++) { Console.WriteLine("Nhap can bo {0}", i); Console.WriteLine("-Nhap 1 neu la cong nhan: "); Console.WriteLine("-Nhap 2 neu la ky su: "); Console.WriteLine("-Nhap 3 neu la nhan vien: "); x = Console.ReadLine(); if (x == "1") { canBos[i] = new CongNhan(); canBos[i].Nhap(); } else { if (x == "2") { canBos[i] = new KySu(); canBos[i].Nhap(); } if (x == "3") { canBos[i] = new NhanVien(); canBos[i].Nhap(); } } } }