home *** CD-ROM | disk | FTP | other *** search
/ C# & Game Programming - A…er's Guide (2nd Edition) / Buono 2nd Ed.iso / Chapter2 / 2.35 / 2.35.cs next >
Encoding:
Text File  |  2004-08-31  |  647 b   |  22 lines

  1. /* Variable scope. */ 
  2. using System;
  3.  
  4. namespace Chapter2 {
  5.     class Class1 {
  6.         // global variable (also the value of a gold bar on earth).
  7.         const double GoldBar = 1000.00;  
  8.  
  9.         static void Main() {
  10.             // local variable (also the value of a gold bar in hell).
  11.             double GoldBar = 0;  
  12.             
  13.             Class1 GlobalCA2 = new Class1();
  14.             Console.WriteLine("The value of gold on earth is "
  15.                 + "${0} per ounce", Class1.GoldBar); 
  16.             Console.WriteLine("The value of gold in hell is "
  17.                 + "${0} per pound", GoldBar); 
  18.         } 
  19.     }
  20. }
  21.  
  22.