|
|
Warp wrote:
> By the same logic this would also "break modularity":
>
> T obj;
> T obj2 = obj;
Not really. operator= is declared in T.
> All the data in obj is copied to obj2. This includes all the private data.
Only if you say that's how you want it to work.
> However, the memcpy() version *is* breaking modularity because, as the
> text says, it's guaranteed to work only if the object contains scalar
> types. If you assume it does, you are breaking modularity.
You don't have to assume it does. You can read the header file and see it
does. :-)
In any case, yes, you're breaking modularity. That's what we're saying, yes?
Accessing private variables without the permission of the class breaks
modularity? Accessing private variables by address in a
standards-conforming way breaks modularity. Given that you're agreeing with
me, I'm not sure what the "however" in your sentence is supposed to imply.
--
Darren New, San Diego CA, USA (PST)
My fortune cookie said, "You will soon be
unable to read this, even at arm's length."
Post a reply to this message
|
|