[Vala] Classes as objects?



Hi all,

Is it possible to treat classes as objects in Vala, similar to how delegates let you treat methods as objects?

What I'm trying to do is go through a list of classes and call a static method on each. In Python, I could do this as

for klass in [Class1, Class2]:
    klass.static_method()

In Vala, when I try

foreach (var klass in {Class1, Class2})
    klass.static_method();

I get "error: initializer list used for unknown type" at the open brace.

If it helps, all of the classes are descended from the same superclass.

Thanks in advance,
Robert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]