Your edit was wrong. The code was correct in the first version (it is creating an instance of the concrete class and storing it in an variable declared as the interface class - which is correct).
The fact that it was approved by two other users is important (they should have spotted the error or left it alone if they didn't understand), but mistakes happen. The OP would have been notified of the edit which led to it being rolled back.
Obviously there's no edit summary box for a rollback so there's not a lot that can be done to explain why it was reverted. Though this answer explains how you can leave an edit - by selecting "edit" on the revision you want to roll back to. It's not a well known feature so you can't expect everyone to use it when they roll back.
Certainly re-editing without more research is a bad idea.