我正在关注RPG c#教程,并且遇到了这个错误。在教程中没有解释,我不确定我做错了什么。
这是班级:
TRUE
问题在于: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>();
}
}
}
我收到错误消息:“不一致的可访问性:属性类型'列表'比属性'Monster.LootTable'更难访问”
我在另一个类中也得到了相同的错误消息,但是如果我可以解决这个问题,我希望可以修复另一个。
答案 0 :(得分:1)
将LootItem类设为公共,
public class LootItem
{
}
}