home *** CD-ROM | disk | FTP | other *** search
- /* Variable scope. */
- using System;
-
- namespace Chapter2 {
- class Class1 {
- // global variable (also the value of a gold bar on earth).
- const double GoldBar = 1000.00;
-
- static void Main() {
- // local variable (also the value of a gold bar in hell).
- double GoldBar = 0;
-
- Class1 GlobalCA2 = new Class1();
- Console.WriteLine("The value of gold on earth is "
- + "${0} per ounce", Class1.GoldBar);
- Console.WriteLine("The value of gold in hell is "
- + "${0} per pound", GoldBar);
- }
- }
- }
-
-