How Non-Member Functions Improve Encapsulation
The function declaration rule by Scott Meyers
if (f needs to be virtual)
make f a member function of C;
else if (f is operator>> or
operator<<) { make f a non-member function; if (f needs access to non-public members of C) make f a friend of C; } else if (f needs type conversions on its left-most argument) { make f a non-member function; if (f needs access to non-public members of C) make f a friend of C; } else if (f can be implemented via C's public interface) make f a non-member function; else make f a member function of C;
abraxsus 홈피에서 보고 링크를 따라갔다가 본 글.
물론 어떤 부분은 논쟁의 소지가 있는 것은 사실이지만, 굉장히 놀라운 글입니다..
꼭 읽어보시길.
더불어 이 링크도…
C/C++ Users Journal
그야말로 C++에는 굉장한 유연성이 있다.. 라는 것과
Scott Myers의 이름이 유명세를 치르는데는 이유가 있다는 생각이 드네요.
더구나 이렇게 글 잘쓰는 공돌이라니 -_-;;;
나도 글 잘쓰고 싶어요..
Leave a Reply