I have Generator class that generates objects with different Interfaces with different probabilities. All objects generated by Generator is of type `BaseClass`. `BaseClass` is an abstract base class.

Lets say interfaces are `I1`, `I2`

I have another class `Resolver` that has polymorphic method for two interfaces as follows:

`Resolve(I1 myObj){//code for I1}`

`Resolve(I2 myObj){//code for I2}`

The main class looks like this:
`BaseClass event = Generator.generate(); //event is implements I1 or I2. Not known what interfaces until run time.
Resolver.Resolve(event); //Here i got an error, because event is BaseClass type and not I1 or I2 type.`

Is there a way to solve this issue without explicitly check Interface type and cast it to appropriate interface. I came from python background, so statically typed language is new for me.