jellev
10-08-2009, 05:01 PM
Hi there,
I'm working on a program with some classes.
I made my mainclass a singleton, called GameInput.
This class has a private List<Group> of some groups(objects).
when I create the getter and setter there is given an error:
Error 1 Inconsistent accessibility: property type 'System.Collections.Generic.List<GameInput.Group>' is less accessible than property 'GameInput.GameInput.groepen' G:\Programming\userfull\GameInput\GameInput\GameInput.cs 34 22 GameInput
this is my code of my main class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace GameInput
{
public sealed class GameInput
{
static GameInput gi = null;
private List<Group> groepen_;
private GameInput()
{
groepen_ = new List<Group>();
groepen_.Add(new Group("z"));
}
public static GameInput GI
{
get
{
if (gi == null)
{
gi = new GameInput();
}
return gi;
}
}
// here its going wrong...
public List<Group> groepen { get { return groepen_; } set { groepen_ = value; } }
public void printGroepen()
{
int i = 0;
foreach (Group obj in groepen_)
Console.WriteLine(" [{0}]: {1}", i++, obj.Name);
Console.WriteLine();
}
}
}
Does anyone knows what's going wrong?
I'm working on a program with some classes.
I made my mainclass a singleton, called GameInput.
This class has a private List<Group> of some groups(objects).
when I create the getter and setter there is given an error:
Error 1 Inconsistent accessibility: property type 'System.Collections.Generic.List<GameInput.Group>' is less accessible than property 'GameInput.GameInput.groepen' G:\Programming\userfull\GameInput\GameInput\GameInput.cs 34 22 GameInput
this is my code of my main class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace GameInput
{
public sealed class GameInput
{
static GameInput gi = null;
private List<Group> groepen_;
private GameInput()
{
groepen_ = new List<Group>();
groepen_.Add(new Group("z"));
}
public static GameInput GI
{
get
{
if (gi == null)
{
gi = new GameInput();
}
return gi;
}
}
// here its going wrong...
public List<Group> groepen { get { return groepen_; } set { groepen_ = value; } }
public void printGroepen()
{
int i = 0;
foreach (Group obj in groepen_)
Console.WriteLine(" [{0}]: {1}", i++, obj.Name);
Console.WriteLine();
}
}
}
Does anyone knows what's going wrong?