I am new to C# and am having trouble calling methods of a class object that is inside of another class object. I get an error saying that 'MainWindow.Mascot.MyNameIs()' is inaccessible due to its protection level. However, all of the classes are public. How can I call a class method of an object from inside another object?
Thanks!
Here is part of the code:
public partial class MainWindow : Window { public class Mascot { string name; string MyNameIs() { return name; } } public class School { public Mascot myMascot; } public MainWindow() { InitializeComponent(); School Houston = new School(); Houston.myMascot = new Mascot(); Houston.myMascot.MyNameIs(); } }