Class Order Style

Seb via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 21 15:11:55 PST 2017


On Monday, 20 February 2017 at 13:47:07 UTC, Jolly James wrote:
> How to sort the members of a class?
>
> like:
>>1. properties
>>then
>>2. private 3. methods
>>4. ctors
> ... and so on. are there any recommendations?
>
>
> And what is better?
>
>>class A
>>{
>>private:
>>    int a;
>>    int b;
>>public:
>>    int c;
>>    int d;
>>}
> or
>>class A
>>{
>>    private
>>    {
>>        int a;
>>        int b;
>>    }
>>    public
>>    {
>>        int c;
>>        int d;
>>    }
>>}

Two pointers towards two popular style guides, which could also 
help to answer future questions:

http://dlang.org/dstyle.html

https://vibed.org/style-guide


More information about the Digitalmars-d-learn mailing list