<div dir="ltr"><div><div><div><div><div><div><div><div>Hello!<br></div><div><br>You can implement static functions that act like members, like so:<br><br>---<br></div>void myFunc(MyClass c) { ... }<br>---<br><br></div>Which you will be able to call like:<br>
<br>---<br></div>auto c = new MyClass();<br></div>c.myFunc();<br>---<br><br></div>because of uniform function call syntax (UFCS).<br><br>But they won't be real methods (virtual member functions), which means they can't be overridden.<br>
<br></div>Note that you can use the class's private members in such functions, because private things in D are private to the file (module) instead of the containing class or struct.<br><br></div>I don't think it's possible to do the same thing as in C++ though; but I might be wrong.<br>
<br></div>Why would you like to do that?<br></div>