public class House { public House() { Room = new Room(); } public Room Room { get; private set; } } public class Room { public Room() { Door = new Door(); } public Door Door { get; private set; } } public class Door { public event EventHandler<EventArgs> OnOpen; public event EventHandler<EventArgs> OnClose; private bool _isOpen; public Door() { } public void Open() { _isOpen = true; OnOpen(this, new EventArgs()); } public void Close() { _isOpen = false; OnClose(this, new EventArgs()); } }
public House() { Room = new Room(); }
public Room Room { get; private set; }
}
public class Room { public Room() { Door = new Door(); } public Door Door { get; private set; } } public class Door { public event EventHandler<EventArgs> OnOpen; public event EventHandler<EventArgs> OnClose; private bool _isOpen; public Door() { } public void Open() { _isOpen = true; OnOpen(this, new EventArgs()); } public void Close() { _isOpen = false; OnClose(this, new EventArgs()); } }
public class Room {
public Room() { Door = new Door(); }
public Door Door { get; private set; }
public class Door {
public event EventHandler<EventArgs> OnOpen; public event EventHandler<EventArgs> OnClose; private bool _isOpen;
public Door() { }
public void Open() { _isOpen = true; OnOpen(this, new EventArgs()); }
public void Close() { _isOpen = false; OnClose(this, new EventArgs()); }