Inconsistent Accessibility in my code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dragoon317
    New Member
    • Dec 2012
    • 1

    Inconsistent Accessibility in my code

    I get this error. Error 1 Inconsistent accessibility: field type 'ClassAndObject .Person' is less accessible than field 'WindowsFormsAp plication.Form1 .myPerson'


    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using ClassAndObject;
    
    namespace WindowsFormsApplication
    {
        public partial class Form1 : Form
        {
            EnterStudentInfoForm thisEnterStudentInfoForm = new    EnterStudentInfoForm();
            public static Person myPerson = new Person();
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void StudentAppExitButton_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
    
            private void EnterStudentInfoButton_Click(object sender, EventArgs e)
            {
                thisEnterStudentInfoForm.Show();
            }
        }
    }
    Last edited by zmbd; Dec 2 '12, 06:27 AM. Reason: [Z{Please use the <CODE/> formatting button to format your posted code and SQL}{Also Removed the "1" per OP post2}]
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    We would have to see the definition for ClassAndObject. Person. I suspect the interface isn't declared as public.

    Comment

    Working...