OKIEWARDOYO

C#.NET No.8-1

Dec 5th, 2012
992
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. public class MyBase
  2. {
  3.    public virtual string Hai()
  4.    {
  5.       return "Saya base class";
  6.    }
  7. }
  8.  
  9. class MyDerived : MyBase
  10. {
  11.    // Overrides the virtual method menggunakan override keyword:
  12.    public override string Hai()
  13.    {
  14.       return "Saya derived class";
  15.    }
  16.  
  17.    public static void Main()
  18.    {
  19.       MyDerived mD = new MyDerived();
  20.       System.Console.WriteLine(mD.Hai());
  21.    }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment