Dear Carlo,
There is no straight way for doing this requirement, it requires some custom coding. I have a suggestion.
Create a View listing Subjects and set a post relationship filter by the page where the View it is inserted. This will list Subjects(You can list Class values) that are children of the given Professor.
Then use get_view_query_results function(http://wp-types.com/documentation/user-guides/displaying-views-output-with-php) to create an array of Classes.
May this tutorial will help you http://wp-types.com/2013/10/how-to-group-views-results-by-year-and-month/
–
With Regards
Bigul