Reputation: 37
I've already looked in the forum for my problem, saying something about it being private, but I've put all my methods and class into public but I still get this error:
Error1 Inconsistent accessibility: field type '
A_Day_at_the_races.Bet
' is less accessible than field 'A_Day_at_the_races.Guy.MyBet
'
This is my code:
public class Guy
{
public string Name; // The Guy's name
public Bet MyBet; // An instance of Bet() that has his bet
public int Cash; //How much cash he has
// GUI controls on the form
public RadioButton MyRadioButton; // My RadioButton
public Label MyLabel; // My Label
}
Upvotes: 1
Views: 256
Reputation: 149020
It looks like your Bet
type was declared as internal. Either you explicitly declared it as internal, or if you didn't provide any accessibility modifier, it will be considered internal by default.
Try making your Bet
type public instead:
public class Bet { ... } // or public struct Bet / public interface Bet
You can then use it to declare public members of other public types:
public class Guy
{
public Bet MyBet; // or public Bet MyBet { get; set; } to create a property
...
}
Further Reading
Upvotes: 3