Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 13, 2016 18:41:16 Jamal via Digitalmars-d-learn wrote: > Warning D newb here. > > Is it possible to define a member function outside of the > class/struct like in C++; > > class x { body > void foo(int* i); > }; > > void x::foo(int* i){ > *i++; > } > > Or is it just D-like

Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-05-13 20:41, Jamal wrote: Or is it just D-like to define everything inside the class/struct body? Yes, the D-way is to define everything directly inside the class/struct. -- /Jacob Carlborg

Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Ali Çehreli via Digitalmars-d-learn
On 05/13/2016 11:41 AM, Jamal wrote: Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; class x { body void foo(int* i); }; void x::foo(int* i){ *i++; } Or is it just D-like to define everything inside the class/struct body?

Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/16 2:41 PM, Jamal wrote: Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; Not within the same file. You can have an "interface file", extension .di, which hides the bodies of functions. But inside the implementation file, you

Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Jamal via Digitalmars-d-learn
Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; class x { body void foo(int* i); }; void x::foo(int* i){ *i++; } Or is it just D-like to define everything inside the class/struct body?