[ CnUnix ] in KIDS 글 쓴 이(By): zeo (ZeoDtr) 날 짜 (Date): 1994년02월08일(화) 15시48분42초 KST 제 목(Title): [대답?] polymorphism? polymorphism이란 단어는 The Annotated C++ Reference Manual (ARM이라고도 하죠, 아마?)의 한군데(확신은 못하겠지만 index에 한군데밖에 안나왔따...)에 있습니다. 저자의 협의 없이 맘대로 발췌해 보면, (209쪽) The use of derived classes and virtual functions is often called `objected-oriented programmimg'. Furthermore, the ability to call a variety of functions using exactly the same interface - as is provided by virtual functions - is sometimes called `polymorphism'. 이 글을 보면 아마 Stroustrup 아저씨는 polymorphism이란 단어를 별로 쓰고 싶지 않아하는 눈치네요. 그리고, Overloading에 대한 구절을 역시 맘대로 발췌해 보면 ,(307쪽) Overloading allows multiple functions with the same name to be defined provided their argument lists differ sufficiently for calls to be resolved. By overloading operators, the programmer can redefine the meaning of most C++ operators when at least one operand is a class object. 고 바로 밑에, When several different function declarations are specified for a single name in the same scope, that name is said to be overloaded. 여기서 다른 점이 뭘까? 우선, 같은 이름의 함수 (혹은 연산자) 가 여러개 있어 서로 다르게 동작할 수 있도록 하는 것은 똑같네요. 다른 점을 생각해 보면, Overloading은 그 이름에 가해지는 argument (C++에서는 연산자에게 주어지는 것들도 argument로 볼 수있다) 들이 컴파일러로 하여금 그 이름을 가지고 있는 함수나 연산자들의 집합중 적절한 것을 선택할 수 있을 만큼 충분히 다른 것이고, polymorphism은 argument까지 완전히 같은 것을 말하는 것 같네요. 따라서, 후자는 컴파일러가 미리 집합중 하나를 선택할 수 없겠죠. runtime에서 보자... 이런 거죠. 뭐, 근데 Bjarn Stroustrup의 책만을 가지고 본다면 (The C++ Programming Language 포함) polymorphism이란 말은 C++ 세계에서 그다지 사용되지 않는 것 같군요. 잊어먹어도 될라나... 도움이 됐는지 모르겠네요... 뱀다리: 나도 C++은 비교적 초보여... 또다리: 덕분에 저도 공부가 됐네요. 고맙. ZZZZZZ zZZ eeee ooo zZ Eeee O O ZZZZZZ Eeee OoO |