abstract_abstract.vala added
This commit is contained in:
parent
5f880bf114
commit
5233bd5928
|
@ -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 ());
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
valac abstract_abstract.vala && ./abstract_abstract
|
Loading…
Reference in New Issue