T
Tony Johansson
Hello!
If I have class Line in my program and compile I get these errors
Error 1 Inconsistent accessibility: field type 'Line.Point' is less
accessible than field 'Line.starting'
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 90 20
ConsoleApplication1
Error 2 Inconsistent accessibility: field type 'Line.Point' is less
accessible than field 'Line.ending'
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 91 20
ConsoleApplication1
The reason for this is because I define a class within another class the
Point class will have access rights as Private.
So private is less accessible then public which is correct.
But if I set the access right to internal on the Point class it's still less
then public but it will work.
So the error message is in some way wrong because as I mentioned having
internal on the Point is less accessible then
field 'Line.staring' and field 'Line.ending'
I'm I right in my conclusion ?
class Line
{
class Point
{
int x = 0;
int y = 0;
}
public Point starting = new Point();
public Point ending = new Point();
}
//Tony
If I have class Line in my program and compile I get these errors
Error 1 Inconsistent accessibility: field type 'Line.Point' is less
accessible than field 'Line.starting'
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 90 20
ConsoleApplication1
Error 2 Inconsistent accessibility: field type 'Line.Point' is less
accessible than field 'Line.ending'
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 91 20
ConsoleApplication1
The reason for this is because I define a class within another class the
Point class will have access rights as Private.
So private is less accessible then public which is correct.
But if I set the access right to internal on the Point class it's still less
then public but it will work.
So the error message is in some way wrong because as I mentioned having
internal on the Point is less accessible then
field 'Line.staring' and field 'Line.ending'
I'm I right in my conclusion ?
class Line
{
class Point
{
int x = 0;
int y = 0;
}
public Point starting = new Point();
public Point ending = new Point();
}
//Tony