Multi-purpose Pin Setting in mbed

Hi there,

If I am planing to use a GPIO as output and interrupt in the different running time, how do I declare this pin object?
I know “DigitalOut” as an output pin object, and InterruptIn as an interrupt object.
Can I declare two types objects on the same GPIO pin?

Thanks,
Henry Xin