If you are using quadrature encoders connected to the RIO, you should follow the example code under "Getting Encoder Values".
https://wpilib.screenstepslive.com/s...or-other-shaft
If you are using quad encoders connected to the Talon SRX, follow the examples in the Talon SRX SOftware Reference Manual.
If you are using analog encoder (like MA3) connected to RIO you need to create an analogInput.
But regardless DigitInput is not the correct class. Also in your example enc is a pointer to an object, which has member functions which are typically called to get useful information.