Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Call mutato...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 45883 of 46738
Post > Topic >>

Re: Call mutators or attributes directly inside class?

by Christopher <cpisz@[EMAIL PROTECTED] > May 12, 2008 at 08:41 AM

On May 12, 10:26 am, Travis <travis.bow...@[EMAIL PROTECTED]
> wrote:
> Is it considered good practice to call a mutator when inside the same
> class or modify the attribute directly?
>
> So if there's a public method SetName() would it be better from
> say ::Init() to call SetName("none") or just set name="none"?

IMO, when you are writing the implementation of the class, use the
most efficient method, unless it will require a lot of code
duplication.

In the example you provided. I would surely write m_name="none";
 




 5 Posts in Topic:
Call mutators or attributes directly inside class?
Travis <travis.bowers@  2008-05-12 08:26:15 
Re: Call mutators or attributes directly inside class?
Christopher <cpisz@[EM  2008-05-12 08:41:44 
Re: Call mutators or attributes directly inside class?
Andrey Tarasevich <and  2008-05-12 09:00:18 
Re: Call mutators or attributes directly inside class?
Travis <travis.bowers@  2008-05-12 09:26:02 
Re: Call mutators or attributes directly inside class?
=?UTF-8?B?RXJpayBXaWtzdHL  2008-05-12 16:56:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 0:10:24 CDT 2008.