abstract_abstract.vala added

This commit is contained in:
Kolan Sh 2014-10-10 18:06:03 +04:00
parent 5f880bf114
commit 5233bd5928
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,38 @@
using GObject.Plugins;
namespace GObject.Plugins {
public interface IPlugabble : Object {
public abstract string get_name ();
}
public abstract class Plugin : Object, IPlugabble {
public abstract string get_name ();
}
public abstract class PluginTypeA : Plugin {
// don't write anything here
}
public class PluginTypeA1 : PluginTypeA {
public override string get_name () { return "Any object of PluginTypeA1 class"; }
}
public class Module {
Type t;
public Module (Type t) {
this.t = t;
}
public IPlugabble create_instance () {
return Object.new (t) as IPlugabble;
}
}
}
void main () {
var m = new Module (typeof (PluginTypeA1));
var o = m.create_instance ();
stdout.printf ("o.get_name () = %s", o.get_name ());
}

3
vala/abstract_abstract/run.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
valac abstract_abstract.vala && ./abstract_abstract