Help with reference to a non shared member! RRS feed

  • Question

  • Hello everyone,

    I am trying to learn Visual Basic and to do so I am doing all my projects from School made in Java now in Visual basic but implementing a Polynomial Class  I have this error message:

    Reference to a non-shared member requires an object reference!

    My Polynomial Class implementation look like this:

    Instance variable of the class

    Public Shared ZERO As Polynomial = New Polynomial
    Private coeff As Integer()
    Private degree As Integer 

    the class implements the IEnumerable interface alone with an inner private class implementation of Interface Term, Interface IEnumerator of Term and my problem is in the inner private implementation class of IEnumerator. In this class I declare an integer var and I try to initialize it with the length of the private instance of coeff Array and I get the error message above.

    In Java any inner class has access to the private fields of the outer class but I don't know why Visual Basic doesn't let me.

    If anyone could help me please, thank you

    Thursday, May 2, 2013 6:03 PM