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

.NET ProgrammingC#

Avatar of undefined
Last Comment
Guy Hengel [angelIII / a3]

8/22/2022 - Mon
Guy Hengel [angelIII / a3]

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.
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
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jpipkins

ASKER
Ahh!  Excellent!  It was defined:  

static class Program

when I changed it to:

public static class Program

It works!  Thank you!
Your help has saved me hundreds of hours of internet surfing.
fblack61
Guy Hengel [angelIII / a3]

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