Old sensors are not reassignable

When I go to reassign a potentiometer or an encoder I get a not assignable error despite this working with motors perfectly fine. My main reason for reassigning the pot/encoder is because I want one of my classes to take in a pot/encoder in the constructor and a private variable to it in order to access the methods of that pot/encoder in the class later. Is there any way to fix this or workaround?

In my class:
image
How the variable is assigned outside of the class (since it’s static):
image
The error when assigning within a function:
image