im trying to use this method to make my characters but i get the error:
inconsistent accessibility:return type'consoleapplication1.Enemigo' is less accesible than
method 'consoleapplication1.poringbuilder.makeporing()'
its the first time i get this error and i really dont know what to do,i have tried alot of different ways but i get the same mistake plz help >.<
namespace ConsoleApplication1
{
public static class PoringBuilder
{
public static Enemigo MakePoring()
{
return new Enemigo(15, 0, 30,15, false, false,"Poring");
}
}
this is another class
namespace ConsoleApplication1
{
class Enemigo:Personaje
{
public Enemigo(int Damage, int Defensa, int HP,int MP, bool Evade, bool Counter, string Nombre)
: base(Damage, Defensa, HP,MP, Evade, Counter, Nombre)
{
}
}
}
this is the parent of all my classes
namespace ConsoleApplication1
{
class Personaje
{
public int Damage;
public int Defensa;
public int HP;
public int MP;
public bool Evade;
public bool Counter;
public string Nombre;
//public Personaje() { }
public Personaje(int Damage, int Defensa, int HP,int MP, bool Evade, bool Counter, string Nombre)
{
this.Damage = Damage;
this.Defensa = Defensa;
this.HP = HP;
this.MP = MP;
this.Evade = Evade;
this.Counter = Counter;
this.Nombre = Nombre;
}
}
}
and im using it on the main program like this
List<Enemigo> EnemigosNoob = new List<Enemigo>();
EnemigosNoob.Add(PoringBuilder.MakePoring());
i hope im precise enough >.< i tried making it public and its not solving anything >.<
Best Answer
Your
MakePoring
method is public, while yourEnemigo
class is not.You need to declare the
Enemigo
class as public: