Just wonder if myClass is 'Internal', how come the console application
The only way it can is if myClass is in the same assembly as the code
using it, or it has an explicit "public" access modifier.
If you are sure that you did not include "public" as the access modifier,
then it must be in the same assembly.
Here's the class library code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch09ClassLib
{
class MyExternalClass
{
}
}
Here's the console application:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ch09ClassLib;
namespace Ch09Ex02
{
class Program
{
static void Main(string[] args)
{
MyExternalClass myObj = new MyExternalClass();
Console.WriteLine(myObj.ToString());
Console.ReadKey();
}
}
}
I compiled and get the compilation error:
'Ch09ClassLib.MyExternalClass' is inaccessible due to its protection level.
I think it was working before because I added the 'public':
namespace Ch09ClassLib
{
public class MyExternalClass
{
}
}
So this book has this error.
Please if someone is/are reading this book, can you guys tell me that's the
book's mistake or my fault?
Beginning Microsoft Visual C# 2008
ISBN:978-0-470-19135-4
Wrox