Clarifying 'const' terminology

Hasan Aljudy hasan.aljudy at gmail.com
Sun Jul 9 03:39:39 PDT 2006



Bruno Medeiros wrote:
<snip>
> 
> 
> "However, in D they are one and the same thing - a class member must be 
> declared and defined at the same time."
> Not entirely correct, remember d header files? What happens in D, is 
> that if there is a definition, then there must also be declaration 
> (they're the same actually). But there can be just a definition:
> 
>   class Foo {
>     void func();
>   }
> 
> This means that in D, just as C++, there is no way for the compiler to 
> know in all cases whether the func changes or not the object instance. 
> Thus, it is necessary for the user to specify it.
> 

However, practically speaking, in D (unlike C++) the interface is 
probably always derived from the actual implementation.



More information about the Digitalmars-d-learn mailing list