[Issue 6570] 'this' silently passes from one object to another

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 2 10:28:46 PST 2012


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich at gmail.com
         Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-02 10:28:46 PST ---
I don't know why 'T2' was in output, it should be 'T' (and it is now).

As for why it works: this is used to pick a specific override in some base
class, e.g.:

class A
{
    void test() { }
}

class B : A
{
    override void test() { }
}

class C : B
{
    override void test() { A.test(); }
}

If you use 'super.test()' you would end up calling B.test instead of A.test.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list