¸Þ¼¼Áö (Message)
¸Þ¼¼Áö (Message)
- °´Ã¼ Á¢±Ù ¹æ¹ý
- One object accesses another object by sending it a message.
- The only way one object should access another.
- An object-oriented program is a system of communicating objects.
- ¸Þ¼¼Áö
- A message consists of the name of operation and any required arguments:
. - myPoint . move (10, 2);
myPoint . setcolor (blue);
- The set of messages to which an object can respond is known as the behavior or protocol of the object.
¼Û½Å °´Ã¼
Operation Name
& Arguments
¼ö½Å °´Ã¼
Notes:
- example
- class point {
int xPosition;
int yPosition;
colorType color;
public:
...
void move (int x, int y) {...
void setColor (colorType c) {...
}
- Point myPoint;
myPoint.move (10, 15);
myPoint.setColor (blue);