Determining whether something is an interface?

Daniel Keep daniel.keep.lists at gmail.com
Mon Nov 12 14:41:23 PST 2007



Christopher Wright wrote:
> You can determine whether a type is a class:
> is (T : Object)
> 
> There's no equivalent for interfaces. You can use the compiles trait:
> __traits(compiles, class Something : T {})
> Except you can't -- it only takes expressions, not declarations.
> 
> There are traits for abstract classes (interfaces aren't) and final
> classes; how about something for interfaces? Or should I just start
> using abstract classes instead?

Have you tried is( T == interface ) ?

	-- Daniel


More information about the Digitalmars-d-learn mailing list