P
pauldepstein
I saw some code where a struct is declared with all members public
(not explicitly so but by omission -- the word private never
appears). Then some operators are declared as friends of this
struct. Is there ever any reason to do this? Obviously, from a legal
and algorithmic standpoint, such code is redundant. However, I don't
feel ready to condemn it right away. For example, a future programmer
might want to declare some of the members private which would make the
friendship necessary. Furthermore, it signals that the named
operators will operate on the members of the struct which may be an
aid to understanding.
Any opinions?
Paul Epstein
(not explicitly so but by omission -- the word private never
appears). Then some operators are declared as friends of this
struct. Is there ever any reason to do this? Obviously, from a legal
and algorithmic standpoint, such code is redundant. However, I don't
feel ready to condemn it right away. For example, a future programmer
might want to declare some of the members private which would make the
friendship necessary. Furthermore, it signals that the named
operators will operate on the members of the struct which may be an
aid to understanding.
Any opinions?
Paul Epstein