Auto-add static field when inherit // mixins, templates?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 21 13:16:32 PDT 2014
On Thursday, 21 August 2014 at 19:58:18 UTC, MarisaLovesUsAll
wrote:
> When I make mixin injection in one class, I want auto-injection
> in another class. How can I do this?
>
> class Component:GameObject
> {
> //second injection must be here and must be automatic
> };
>
> class Sprite:Component
> {
> mixin Manager; //first injection must activate second
> injection by misterious way
> };
I don't think this is possible.
> mixin template Manager() {}
> mixin template ComponentCaster(string type) {} //where 'type'
> is a type obtained from Manager
> //by typeof(this).stringof. As example, "Sprite".
Maybe you can explain what you're trying to achieve with all
this. There may be a different/better way to do it.
More information about the Digitalmars-d-learn
mailing list