digitalmars.D - silently accept &parentclassName.func can be bug-prone
- davidl (25/25) Jun 06 2009 import std.stdio;
import std.stdio; class t { void func(){writefln("t");} void delegate() getdelegate(){return &func; } } class v:t { void func(){writefln("v");} } class r:v { void func(){writefln("r");} void delegate() getdelegate(){return &t.func; } // someone write this may expect the compiler to return the delegate of func in class t } void main() { r p= new r; p.getdelegate()(); } currently it prints "r" -- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Jun 06 2009