Non-ugly ways to implement a 'static' class or namespace?

Ali Çehreli acehreli at yahoo.com
Fri Jan 20 21:32:22 UTC 2023


On 1/20/23 07:01, torhu wrote:

 > But why not have drawLine just be a free function?

Exactly.

If I'm not mistaken, and please teach me if I am wrong, they are 
practically free functions in Java as well. That Java class is working 
as a namespace. So, the function above is the same as the following 
free-standing function in D, C++, C, and many other languages:

   void Algo_drawLine(Canvas c, Pos from, Pos to) { ...... };

Ali



More information about the Digitalmars-d-learn mailing list