Re: Function implemented outside the class

2014-03-25 Thread Rikki Cattermole
On Sunday, 23 March 2014 at 21:48:33 UTC, MarisaLovesUsAll wrote: Hi! I didn't find how to implement functions outside the class, like in C++. C++: class MyClass { void myFunc(); }; void MyClass::myFunc() { ... } Is it possible to do this in D ? Sorry for my bad English. Regards, Alexey

Re: Function implemented outside the class

2014-03-24 Thread MarisaLovesUsAll
On Monday, 24 March 2014 at 01:34:22 UTC, Matej Nanut wrote: 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

Re: Function implemented outside the class

2014-03-24 Thread Steven Schveighoffer
On Mon, 24 Mar 2014 16:02:25 -0400, MarisaLovesUsAll maru...@2ch.hk wrote: On Monday, 24 March 2014 at 01:34:22 UTC, Matej Nanut wrote: Hello! You can implement static functions that act like members, like so: --- void myFunc(MyClass c) { ... } --- Which you will be able to call like:

Function implemented outside the class

2014-03-23 Thread MarisaLovesUsAll
Hi! I didn't find how to implement functions outside the class, like in C++. C++: class MyClass { void myFunc(); }; void MyClass::myFunc() { ... } Is it possible to do this in D ? Sorry for my bad English. Regards, Alexey

Re: Function implemented outside the class

2014-03-23 Thread bearophile
MarisaLovesUsAll: C++: class MyClass { void myFunc(); }; void MyClass::myFunc() { ... } Is it possible to do this in D ? It's not possible. Some people want it to happen, some other people hate it. Bye, bearophile

Re: Function implemented outside the class

2014-03-23 Thread John Colvin
On Sunday, 23 March 2014 at 21:48:33 UTC, MarisaLovesUsAll wrote: Hi! I didn't find how to implement functions outside the class, like in C++. C++: class MyClass { void myFunc(); }; void MyClass::myFunc() { ... } Is it possible to do this in D ? Sorry for my bad English. Regards, Alexey

Re: Function implemented outside the class

2014-03-23 Thread John Colvin
On Sunday, 23 March 2014 at 22:20:39 UTC, John Colvin wrote: On Sunday, 23 March 2014 at 21:48:33 UTC, MarisaLovesUsAll wrote: Hi! I didn't find how to implement functions outside the class, like in C++. C++: class MyClass { void myFunc(); }; void MyClass::myFunc() { ... } Is it possible

Re: Function implemented outside the class

2014-03-23 Thread Matej Nanut
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