T
Tony Johansson
Hello!
I want to say that I rather new to C# have only worked with it for 5 month.
I'm now reading a book and there are some example on the internal key work
that doesn't work
as the book say. I just want to know if the book is right or wrong.
I have two files with two classes called Class1 and Class2.
The first Class Class1 is located in namespace AccessControl and the second
class
Class2 is located in namespace Test. You can see the classes below.
Class2 has the internal key word on both the class and the constructor and
on the method A_internal().
I can instansiate Class2 from Class1 without any problem and also call the
A_internal() metod that exist in Class2 from Class1 without any problem.
Can somebody explain how this internal work?
//Here is file 1 with name Class1.cs
using System;
using Test;
namespace AccessControl
{
public class Class1
{
public Class1() {} //constructor
public static int Main(string[] strings)
{
Class2 ba = new Class2();
return 0;
}
}
}
//Here is file 2 with name class2.cs
using System;
namespace Test
{
internal class Class2
{
internal Class2() {} //Constructor
internal void A_internal()
{
Console.WriteLine("Class2.A_internal");
}
}
}
Many thanks
//Tony
I want to say that I rather new to C# have only worked with it for 5 month.
I'm now reading a book and there are some example on the internal key work
that doesn't work
as the book say. I just want to know if the book is right or wrong.
I have two files with two classes called Class1 and Class2.
The first Class Class1 is located in namespace AccessControl and the second
class
Class2 is located in namespace Test. You can see the classes below.
Class2 has the internal key word on both the class and the constructor and
on the method A_internal().
I can instansiate Class2 from Class1 without any problem and also call the
A_internal() metod that exist in Class2 from Class1 without any problem.
Can somebody explain how this internal work?
//Here is file 1 with name Class1.cs
using System;
using Test;
namespace AccessControl
{
public class Class1
{
public Class1() {} //constructor
public static int Main(string[] strings)
{
Class2 ba = new Class2();
return 0;
}
}
}
//Here is file 2 with name class2.cs
using System;
namespace Test
{
internal class Class2
{
internal Class2() {} //Constructor
internal void A_internal()
{
Console.WriteLine("Class2.A_internal");
}
}
}
Many thanks
//Tony