OKIEWARDOYO

C#.NET No.5-3

Nov 30th, 2012
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. //Coba.cs
  2. // Namespace Declaration
  3. using System;
  4. // helper class
  5. class Coba
  6. {
  7.     string text_ku;
  8.  
  9.     // Constructor
  10.     public Coba(string input_text)
  11.     {
  12.         text_ku = input_text;
  13.     }
  14.  
  15.     // Instance Method
  16.     public void tampil()
  17.     {
  18.         Console.WriteLine("{0}", text_ku);
  19.     }
  20.  
  21.     // Destructor
  22.     ~Coba()
  23.     {
  24.         // Some resource cleanup routines
  25.     }
  26. }
  27.  
  28. // Program start class
  29. class Program
  30. {
  31.     // Main begins program execution.
  32.     public static void Main()
  33.     {
  34.         // Instance of Coba
  35.         Coba contoh = new Coba("Hai, saya C#");
  36.  
  37.         // Call Output class' method
  38.         contoh.tampil();
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment