Hello!

You can implement static functions that act like members, like so:

---
void myFunc(MyClass c) { ... }
---

Which you will be able to call like:

---
auto c = new MyClass();
c.myFunc();
---

because of uniform function call syntax (UFCS).

But they won't be real methods (virtual member functions), which means they can't be overridden.

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.

I don't think it's possible to do the same thing as in C++ though; but I might be wrong.

Why would you like to do that?