Creating own object model (like that of Excel VBA)
<p>I am new to Stackoverflow &amp; <em>hope members will forgive me if I ask a wrong question</em>. 
I have just started learning C# and classes. A very fundamental question that came to my mind is how can I create an object model (hierarchy) of my classes. Let me explain :</p>

<p>Lets say, I have a class called <strong>PEX</strong>. When I instantiate this class it should contain some properties, methods &amp; another class called <strong>Windows</strong>. Now Windows will also contain some method &amp; property &amp; another class <strong>Window</strong>. </p>

<p>class Windows &amp; Window should not be accessible directly but rather only through PEX class.</p>

<p>Windows will return all Window instances....basically like the Excel Object model.</p>

<p>I should be able to do foreach(Window window in PEX.Windows) { ....} and other such stuff...
I also read inheritance but cannot get this object model in place.</p>

<pre><code>public class PEX
{
    public _Windows Windows;

    public PEX()
    {
        Windows = new _Windows();
    }
}

public class _Windows
{
    public _Window Window;
    private int _count;

    public _Windows()
    {
        Window = new _Window();
        _count = 10;
    }

    public int Count
    {
        get { return _count; }
    }       
}

public class _Window
{

    private string _title;

    public _Window()
    {
        _title = "Roshan";
    }

    public string Title
    {
        get { return _title; }
    }
}
</code></pre>
