Using interface

Monkey Forums/Monkey Programming/Using interface

KaaPex(Posted 2012) [#1]
hi all

I have interface and some classes which implements interface. Can i use interface as param type at method?
For example:
Method Clone:Type( factory:Interface = Null )

For now the error is:
: Type 'Interface' not found

Thanks.


KaaPex(Posted 2012) [#2]
One more thing, i'm using reflection. Maybe here is the problem?


Dima(Posted 2012) [#3]
You should be able to - what's the name of the interface?

If you had and 'Interface Bleh' the param would be 'factory:Bleh'

Cheers,
Dmitriy


KaaPex(Posted 2012) [#4]
Yes i'm using like this:
Method Clone:Particle( factory:ParticleFactory = Null )
Local p:Particle
If( factory ) Then
p = factory.CreateParticle()

Else
p = new Particle()
Endif
return CloneInto( p )
End Method

Where ParticleFactory is interface. But if I import reflection, then became error.