Java Class Extension ( Over riding)
<p>I am trying to extend a binary number class but when i do i cant access some of the base class functions for example the last function i trying to run in main </p>

<pre><code>import java.util.*;

class BinaryNumber
{
    private boolean b[];

    public void setBit(int index, boolean value)
    {
        b[index] = value;
    }

    public boolean getBit(int index)
    {
        return b[index];
    }

    public void clear()
    {
        for (int i = 0; i &lt; 8; i++)
            b[i] = false;
    }

    public BinaryNumber()
    {
        b = new boolean[8];
        for (int i = 0; i &lt; 8; i++)
        {
            b[i] = false;
        }
    }

    public void inputNumber(int a)
    {

        if (a &gt; 11111111)
        {
            System.out.println(" Exception Number to Large Nothing Entered ");
        }
        else
        {

            int number = a;
            int c = 7;
            int digit = 0;

            for (int i = 0; i &lt; 8; i++)
            {
                digit = number % 10;
                if (digit == 1)
                {
                    b[c] = true;
                }
                else if (digit == 0)
                {
                    b[c] = false;
                }
                else
                {
                    System.out.println(" Only Binary Number Accepted ");
                    clear();
                    i = 8; // break
                }
                number = number / 10;
                c--;
            }
        }
    }

    public void outputNumber()
    {
        for (int i = 0; i &lt; 8; i++)
        {
            if (b[i] == true)
            {
                System.out.print("1");
            }
            else
            {
                System.out.print("0");
            }
        }
        System.out.println("");
    }

    public BinaryNumber ANDNumbers(BinaryNumber second)
    {
        BinaryNumber result = new BinaryNumber();
        boolean temp = false;
        for (int i = 0; i &lt; 8; i++)
        {
            result.setBit(i, (b[i] &amp;&amp; second.b[i]));
        }
        return result;
    }
}
</code></pre>

<p>class ExtendedBinaryNumber </p>

<pre><code>class ExtendedBinaryNumber extends BinaryNumber
{
    public ExtendedBinaryNumber binaryAdd(ExtendedBinaryNumber A)
    {
        ExtendedBinaryNumber result = new ExtendedBinaryNumber();
        boolean carry = false;

        for (int i = 7; i &gt;= 0; i--)
        {
            if (getBit(i) == true)
            {
                if (A.getBit(i) == false)
                {
                    if (carry == false)
                    {
                        carry = false;
                        result.setBit(i, true);
                    }
                    else
                    {
                        carry = true;
                        result.setBit(i, false);
                    }
                }
                else
                {
                    if (carry == false)
                    {
                        carry = true;
                        result.setBit(i, false);
                    }
                    else
                    {
                        carry = true;
                        result.setBit(i, true);
                    }
                }
            }
            else
            {
                if (A.getBit(i) == false)
                {
                    if (carry == false)
                    {
                        carry = false;
                        result.setBit(i, false);
                    }
                    else
                    {
                        carry = true;
                        result.setBit(i, true);
                        carry = false;
                    }
                }
                else
                {
                    if (carry == false)
                    {
                        carry = false;
                        result.setBit(i, true);
                    }
                    else
                    {
                        carry = true;
                        result.setBit(i, false);
                    }
                }

            }
        }
        return result;
    }
}
</code></pre>

<p>class Q6</p>

<pre><code>class Q6
{
    public static void main(String args[])
    {

        ExtendedBinaryNumber numA = new ExtendedBinaryNumber();
        int a = Integer.parseInt("10010111");
        numA.inputNumber(a);
        numA.outputNumber();

        ExtendedBinaryNumber numB = new ExtendedBinaryNumber();
        int b = Integer.parseInt("10010101");
        numB.inputNumber(b);
        numB.outputNumber();

        System.out.println("");

        // BinaryNumber c=numA.ANDNumbers(numB);
        // c.outputNumber();

        // ExtendedBinaryNumber dd=numA.binaryAdd(numB);
        // dd.outputNumber();

        ExtendedBinaryNumber dde = numA.ANDNumbers(numB);
        dde.outputNumber();

    }
}
</code></pre>
