Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
| Search | Today's Posts | Mark Forums Read
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 16th, 2010, 09:43 PM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# Inconsistent accessibility

Hi! I've a issue in a project i make. The error shown by VSE is the following:

Error 1 Inconsistent accessibility: return type 'EEscolaridade' is less accessible than method 'MedicalStatistics.AdicionarPaciente.verificaEscol aridadeSelecionada()' C:\Users\Serafim\Documents\Visual Studio 2008\Projects\MedicalStatistics\MedicalStatistics\ AdicionarPaciente.cs 148 31 MedicalStatistics


Code of AdicionarPaciente.cs
Code:
......
        private EEscolaridade verificaEscolaridadeSelecionada()
        {

            if (primeiroCicloradioButton.Checked)
            {
                return EEscolaridade.PrimeiroCiclo;
            }
            else if (escolaridadeObrigatoriaRadioButton.Checked)
            {
                return EEscolaridade.EscolaridadeObrigatoria;
            }

            return EEscolaridade.EnsinoSuperior;

        }

......


Code of Paciente.cs
Code:
......

enum EEscolaridade
{
    PrimeiroCiclo,
    EscolaridadeObrigatoria,
    EnsinoSuperior
}

namespace MedicalStatistics.Classes
{
    class Paciente
    {
        private String nome;
        private EIdade idade;
        private DateTime data;
        private ESexo sexo;
        private EProfissao profissao;
        private String profissaoOutraSituacao;
        private EEscolaridade escolaridade;
        private AvaliacaoTestes avaliacaoTestes;
        private Tratamentos tratamentos;
        private OutrosDados outrosDados;

......
 
Old August 17th, 2010, 04:27 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

With the method verificaEscolaridadeSelecionada() declared as private I don't get any error. If I changed that to public or protected then I get the error.

The default, if no access modifier is supplied for a class or enum it is considered private, so your enum is private. You cannot return a private enum from a method which is not also private.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessibility Checker Xaviar BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 1 April 23rd, 2009 12:46 PM
Accessibility: Screen-Reader & Drop-Down Menu kwilliams HTML Code Clinic 3 August 28th, 2008 03:17 PM
problem with accessibility and role hertendreef ASP.NET 2.0 Professional 1 June 19th, 2007 09:46 AM
accessibility coding error in downloaded file hillcountry BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 0 November 21st, 2006 05:37 PM
inconsistent data stealthdevil Access VBA 2 November 10th, 2006 05:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.