How to access a base class value from derived class c#
<p>Can any one let me know "How to access base class variables in derived class"?</p>

<p>Example:</p>

<p>Class 1.cs Code</p>

<pre><code>public class baseClass
{
    public int intF = 0, intS = 0;
    public int addNo()
    {
        int intReturn = 0;
        intReturn = intF + intS;
        return intReturn;
    }
}

Public class child : baseClass
{
    public int add()
    {
        int intReturn = 0;
        intReturn = base.intF * base.intS;
        return intReturn;
    }
}
</code></pre>

<p>Class2.cs Code</p>

<pre><code>class Program
{
    static void Main(string[] args)
    {
        baseClass obj = new baseClass();
        obj.intF = 5;
        obj.intS = 4;
        child obj1 = new child();
        Console.WriteLine(Convert.ToString(obj.addNo()));
        Console.WriteLine(Convert.ToString(obj1.add()));
        Console.ReadLine();
    }
}
</code></pre>

<p>The problem is in child class which gets inherited from base class..</p>

<p>The value of intF and intS is always showing as 0 instead of 5&amp;4.</p>

<p>Can any one let me know where I am going wrong?</p>

<p>Regards,</p>

<p>G.V.N.Sandeep</p>
