Hi, I commented on some parts of your code to explain maybe a bit better.Hope it helps you understand better!
Not convinced. The reason access is denied is that you are trying to use an instance member of class A as if it were a static member. If you tried that inside an instance method, like this . . . . . . you would suffer the same compiler error. Sean Clark's example answers the original question better.