silently accept &parentclassName.func can be bug-prone
davidl
davidl at nospam.org
Sat Jun 6 07:59:51 PDT 2009
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/
More information about the Digitalmars-d
mailing list