On Friday, 20 December 2013 at 10:06:36 UTC, Jonathan M Davis wrote:
Whereas I put the underscore before (e.g. _x), and some folks like to do m_x
(though I haven't seen many people do that in D - more in C++).


I tend to use the m_x naming convention, though I limit it to private member variables. Otherwise I stick to camelCase.

If it is a parameter that is just going to be assigned to a member variable and they would otherwise have the same name, I usually add a prefix to parameter name to differentiate the two. In constructors it is usually "the" and in setters it is usually "new." Something like:

this(string theTitle)
{
     title = theTitle;
}

void setTitle(string newTitle)
{
     title = newTitle;
}

Reply via email to