[Issue 1225] Super Class method hides the global template from mixin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 15 07:22:45 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1225


davidl at 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Super Class method hides the|Super Class method hides the
                   |global template from mixin  |global template from mixin




------- Comment #1 from davidl at 126.com  2007-09-15 09:22 -------
This illustrate the bug a little more clearly, and also fix some issues of the
original code.
import std.stdio;
template dup(T){
    T dup(){
    auto c=new T;
    foreach(i,x;this.tupleof)
    {
        c.tupleof[i]=x;
        writefln(`tupleof `,x);
    }
    return c;

    }
}
class baseclass
{
//    mixin dup!(baseclass);           // comment this , the dup won't be
hidden anymore in the derive class
    void method(){printf("a.method\n");}
}
class deriveclass:baseclass
{
    mixin dup!(deriveclass);
    int j;
        float i;
    void method(){printf("b.method\n");}
        this()
        {
                i=34;
                j=10;
        }
}
void main()
{
    deriveclass mybinstance = new deriveclass;
    mybinstance.dup();
}


-- 



More information about the Digitalmars-d-bugs mailing list