Method definition

Tim Gunesh tim.moldazhan at gmail.com
Wed Jul 21 13:56:11 UTC 2021


On Wednesday, 21 July 2021 at 12:08:21 UTC, Tim Gunesh wrote:
> Is it possible to define methods outside the class in C ++ 
> style? Something like this:
>
> ```d
> class Parent{
>    void Print();
> }
>
> void Parent.Print(){
>    writeln("Hello, D!");
> }
> ```

I was afraid that this is not possible. I'm partly used to this 
convenience in C++. This allows you to quickly understand the 
content of the class, especially in large undocumented projects. 
I'd love to move this to D. Thanks everyone for the reply and 
thanks to Paul Backus for an alternative way of defining methods!


More information about the Digitalmars-d-learn mailing list