How exactly do “Objects communicate with each other by passing messages”?

前端 未结 10 440
无人及你
无人及你 2021-01-30 17:34

In several introductory texts on Object-oriented programming, I\'ve come across the above statement.

From wikipedia, \"In OOP, each object is capable of receivi

10条回答
  •  不思量自难忘°
    2021-01-30 18:04

    Some of the early academic work on OO was in terms of objects passing messages to each other in order to invoke behavior. Some early OO languages were actually written that way (SmallTalk?).

    Modern languages like C++, C# and Java do not work that way at all. They simply have code call methods on objects. This is exactly like a procedural language, except that a hidden reference to the class being called is passed in the call ("this").

提交回复
热议问题