问题
In Java you can have something like this
class MyClass<E extends A> { ...
In C#
class MyClass<E> where E : A { ...
Anything similar in Vala?
回答1:
No, not supported in Vala.
This is all available keywords in the language Vala, and the "where" specifier is not there.
Here is a filled bug to ask for this feature.
I've had need for constraints as well, in the and I had to change my design to use a normal generic type.
来源:https://stackoverflow.com/questions/40692468/bounded-type-parameters-in-vala