An illustration of the 'Inconsistent Accessibility' problem. | Lecture 3 - slide 21 : 29 Program 1 |
namespace N{ class C { } public class D{ public C M(){ // Compiler-time error message: return new C(); // Inconsistent accessibility: // return type 'N.C' is less // accessible than method 'N.D.M()' } } } | Implicitly class C has internal visibility. We have most likely forgotten to declare the visibility of C in the namespace N. |