I am trying to understand how extending a custom class of mine works when I want to set a var in the super class for all sub classes of that super class to use.
So lets say I have a super class called A
and class 1 , 2 and 3 all extend A
The super class has a var called itemNumber, which has a vaule of 2.
The super class (A) also has a getter and setter for the intemNumber var.
Class one sets a value of itemNumber to 5 and uses the supers setter class to set the new value of itemNumber.
I then call the getter of the supper class(A) from the subclass of 2. But that vaule is returned as 2… not 5.
So my question is why? Why is the itemNumber value reflected for subclass 2?