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";