Defining member fuctions of a class or struct out side of the class/struct body?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 13 11:51:37 PDT 2016
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 must repeat the
class/struct definition. So it's a lot of extra work. The compiler can
spit out a .di file based on your implementation with the bodies hidden,
but it's not perfect.
You also can't hide template function bodies.
What is your use case, or is it just that you prefer doing it that way?
-Steve
More information about the Digitalmars-d-learn
mailing list