Use the output of a module inside a class (including task (generator)

In reply to chr_sue:

It does not work with ModelSim 10.1c, i must have questaSim 10
.4?