|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - silently accept &parentclassName.func can be bug-prone
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
|