Why I can access class that is defined outside of namespace?

Viewed 1989

I was wondering Why I can access class when I defined it outside of namespace scope?

I am not very familiar with namespaces, I am just learning, but I thought that namespace should like wrap all my classes to one 'box' and they can access each other just inside that 'box' (scope).

Code example:

class Point
{
    public int X;
}

namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            Point p = new Point();
            p.X = 50;
            Console.WriteLine(p.X);
            Console.ReadLine();
        }
    }
}

Thank you for answers.

2 Answers
Related