16
Mengapa memanggil metode di kelas turunan saya memanggil metode kelas dasar?
Pertimbangkan kode ini: class Program { static void Main(string[] args) { Person person = new Teacher(); person.ShowInfo(); Console.ReadLine(); } } public class Person { public void ShowInfo() { Console.WriteLine("I am Person"); } } public class Teacher : Person { public new void ShowInfo() { Console.WriteLine("I am Teacher"); } } Ketika …
146
c#
class
derived-class