The Linker is not a Magical Program

davidl davidl at nospam.org
Thu Sep 3 19:13:41 PDT 2009


在 Fri, 04 Sep 2009 04:39:28 +0800,Sclytrack <idiot at hotmail.com> 写道:

> 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/



More information about the Digitalmars-d mailing list