in reply to Re: Array copy or encapsulation break?
in thread Array copy or encapsulation break?

D'oh, you're correct. I don't know what i was thinking. I think i was going to dereference and return in GetBigList(), so that callers don't have direct access to the object's internals. But if i keep GetBigList() private, it should be ok.
  • Comment on Re: Re: Array copy or encapsulation break?

Replies are listed 'Best First'.
Re3: Array copy or encapsulation break?
by dragonchild (Archbishop) on Aug 06, 2003 at 17:08 UTC
    Now, you're entering a bigger question - what are you doing with the return from GetBigList()? It is usually considered better practice to provide that functionality within the class and not expose the internals through getters/setters. Often, getters/setters are used because pure OO is almost never feasible, for non-programming reasons.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.