Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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;

......
  #2 (permalink)  
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?
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.