jump to navigation

Ask Everyone: Where’s your Constructor? April 11, 2008

Posted by Brent in computers.
Tags: , ,
trackback

Where do you prefer to put your object’s constructor in relation to the file’s line numbers?

Near the top?  Before or after the member object declarations?

——————

I prefer to keep them near the top, preferably after the private member declarations.  It’s not a hard or fast rule for me, but I dislike it when the constructor(s) is/off mingling with other methods in the middle of the class.

Advertisements

Comments»

1. Derek - April 11, 2008

Always at the top. It really doesn’t make much sense to put it elsewhere.

Of course, if this is not production code (still in development), then it can go anywhere it pleases. 😉


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: