fork download
  1. using System;
  2. class Foo {
  3. public static int bar = 99;
  4. public int baz() {return bar;}
  5. }
  6. public class Test {
  7. public static void Main() {
  8. Foo foo = new Foo();
  9. Console.WriteLine(Foo.bar);
  10. //Console.WriteLine(foo.bar); // error CS0176: Static member `Foo.bar' cannot be accessed with an instance reference, qualify it with a type name instead
  11. Console.WriteLine(foo.baz());
  12. }
  13. }
Success #stdin #stdout 0.02s 22516KB
stdin
Standard input is empty
stdout
99
99