Is base method able to use derived base data members?
<p>Lets assume we have the following code:</p>

<pre><code>abstract class Base1 {
    protected int num;
}

class Der1:Base1 {
    protected Color color;
    protected string name;
}

class Der2:Base1 {
    protected DateTime dthen;
}
</code></pre>

<p>and so on. An array of <code>base1</code> type exists and includes many objects created out of classes that are derived from <code>base1</code>.</p>

<p>Is it possible to define the <code>toString()</code> method in the base class only?
something like:</p>

<pre><code>public override string toString()
{
    if (this is Der1)
        return "num = " + this.num + "color = " + this.color.toString() + " name = " this.name;
    if (this is Der2)
        return "num = " + this.num + "dthen = " + this.dthen.toString();
    // and so on ...
}
</code></pre>

<p>Thank you very much :)</p>

<p>P.S. This is not an homework question. I've just wondered about.</p>
