'Inconsistent Accessibility in Lists c#
I'm following an RPG c# tutorial, and have come across this error. It is not explained in the tutorial, and I'm unsure what i did wrong.
Here is the class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Engine
{
public class Monster : LivingCreature
{
public int ID { get; set; }
public string Name { get; set; }
public int MaximumDamage { get; set; }
public int RewardExperiencePoints { get; set; }
public int RewardGold { get; set; }
public List<LootItem> LootTable { get; set; }
public Monster(int id, string name, int maximumDamage, int rewardExperiencePoints, int rewardGold, int currentHitPoints, int maximumHitPoints) : base (currentHitPoints, maximumHitPoints)
{
ID = id;
Name = name;
MaximumDamage = maximumDamage;
RewardExperiencePoints = rewardExperiencePoints;
RewardGold = rewardGold;
LootTable = new List<LootItem>();
}
}
}
The problem lies in: public List<LootItem> LootTable { get; set; }
I get the error message: "Inconsistent accessibility: property type 'List' is less accessible than property 'Monster.LootTable'"
I also get the same error message in another class, but if I can fix this one, i can hopefully fix the other.
Solution 1:[1]
Make the LootItem class public,
public class LootItem
{
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |