+1 vote
in C Sharp by

What is an Internal class in C#?

1 Answer

0 votes
by

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();

    }

}

Related questions

+1 vote
0 votes
asked Jun 16, 2020 in C Sharp by Hodge
+1 vote
0 votes
asked Oct 18, 2019 in C Sharp by Robin
...