Static Functions and pointers

Kirk McDonald kirklin.mcdonald at gmail.com
Tue Apr 3 12:25:06 PDT 2007


Dan wrote:
> According to the D language spec, a static function:
> 
> static int x(int y){
>   return 3;
> }
> 
> is *not* virtual.  Does this mean I can't use:
> 
> int function(int y) foo = &x;
> 
> ???
> 
> Or is there something that needs to be changed?  I'm at work now and can't test it.  : p

No, it means you *can* use that. Static member functions are in essence 
module-level functions that just happen to live inside a class. Pointers 
to static functions are plain old function pointers.

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org


More information about the Digitalmars-d-learn mailing list