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

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 13 12:01:13 PDT 2016


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?

Also check out the feature called UFCS. It is not the exact answer to 
your question but it may be more applicable in some designs.

Ali



More information about the Digitalmars-d-learn mailing list