Explanation Of User Module

I’m using yii-user module. And one thing that is not quite understandable to me is UserIdentity.php

When I call


I get the right user ID. Before this module I used implemented way of logging in. and whit the same code I got the right user ID. But what bugging me is: why now that code takes information from module (I removed old way of logging in). It is the same line of code and it knows that it has to use module. Is it because UserIdentity extends CUserIdentity which is part of yii core?