Link to home
Create AccountLog in
Avatar of jpipkins
jpipkins

asked on

Inconsistent accessibility

I don't understand the problem here.  I get this error:

Inconsistent accessibility: property type 'Grader.Program._TargetType' is less accessible than property 'Grader.AGComboBox.BoundObject'

On the line specified below.  The enum is defined as:

        public enum _TargetType {Instructor, Term, AssignmentType};

Anyone have an idea where my problem is?
namespace Grader
{
    public class AGComboBox : ComboBox
    {
        private Program._TargetType _BoundObject; //The type of Object for the box
 
        public Program._TargetType BoundObject  <<<--Error Line
        {
            get { return _BoundObject; }
            set { _BoundObject = value; }
        }

Open in new window

Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

the class/type _targetType itself is not "public" in the Program, but probably friend or protected.

so, you either need to change public into friend/protected in your error line, or change friend/protected into public, for example.
Avatar of jpipkins
jpipkins

ASKER

I don't understand.  Doesn't this line in my Program class make _TargetType public?

public enum _TargetType {Instructor, Term, AssignmentType};
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Ahh!  Excellent!  It was defined:  

static class Program

when I changed it to:

public static class Program

It works!  Thank you!
yes, by default it is private if you don't specify the accessibility value.