Categories

Jan 20 in C Sharp (C#)
Q:

What is an Internal class in C#?

1 Answer

Jan 20

An Internal class is a class which cannot be used outside its Assembly. The internal keyword is used to mark a particular class Internal i.e. it restrict its access outside the Assembly.

      An Assembly could be a Project, a DLL or an EXE.

      Inside the Assembly, the internal class is like public class.

      An internal class can be inherited within the Assembly.

Example:

internal class A

{

    public void Fun()

    {

    }

}

//Valid

public class B : A

{

    public static void Fun()

    {

    }

}

public class C

{

    public static void Fun()

    {

        //Valid

        A a = new A();

        a.Fun();

    }

}

Click here to read more about C Sharp
Click here to read more about Insurance

Related questions

Madanswer
Feb 16 in C Sharp (C#)
Oct 18, 2019 in C Sharp (C#)
Apr 9 in C Sharp (C#)
...