Problems with "Access Modifiers" in a class

46 views Asked by At

I can't use any types of "Access Modifiers" in may "Class". If i try to use for example "Public" or "Internal" it comes with fail-code's "CS1519" "CS0106"

image of code problem

I tried to make a "Method" in my "Class" but I couldn't make it visible to my "Program.cs" because my "Class" gave the failcoat and came to look like in the picture.

I hoppe someone can help me.

1

There are 1 answers

5
rotabor On

At this level you aren't able to apply any access modifier. This level is the level of local methods which are accessible from the method contains them. Thus, any access modifier has no sense.

If you need to add another method to the 'bil' class, you should put it after line 20.

public class bil
{
    public bil()
    {
        ... // constructor code here
    } // line 20
    public void PrintInfo()
    {
         Console.WriteLine(" Car");
    }
}