Link to home
Start Free TrialLog in
Avatar of brotherbill999
brotherbill999

asked on

Why can't use private specifier in C#

It compiles, but if you uncomment "private", it fails to compile.  WHY?
Using VS 2005.

using System;
 
namespace myNameSpace
{
    public class MyClass1
    {
          public int age;
    };
 
    public class MyClass2
    {
        public void foo()
        {
            /* private*/ MyClass1 myClass1;
        }
    };
};

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of p_davis
p_davis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brotherbill999
brotherbill999

ASKER

Local variables may not have public, protected or private specifiers.
They are local to the procedure or function and are visible only within that procedure or function.
another way to say what i did, yes -- did you find that on msdn or something?
Thanx for instant response.
um no, i already told you that. just in different words.
crap, sorry -- thanks
No, just figured it out and avoided being embarrassed by such a simple question.
Sorry for not awarding you points.  We crossed in the mail, and you did deserve the points.  Maybe admin could award you the points on request...