在 Fri, 04 Sep 2009 04:39:28 +0800,Sclytrack <[email protected]> 写道:

I was wondering if the following is useful, probably not.

Reserve a spot on the vtable, which is automatically set to NULL.

class AClass
{
  __virtualspot void caption(string text);  //no implementation
  __virtualspot string caption();
}


I think the above is designed for .di files. However, maybe we should limit it to di only. If it's in .d, it probably a bug or workaround of dmd bugs.

class BClass:AClass
{
}

BClass b = new BClass();
b.caption = "test";   //compiles

1. Would compile. But it would not run if the vtable spot
   has not been filled up by some API.

2. Can derive from the class/interface, without providing
   the implementation.





--
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

Reply via email to