Posted on May 31st, 2008 at 16:51 by fr3@K
假設我們需要按照順序以紙條對 Alice 與 Bob 打招呼:
void Alice(string& message_to_alice); void Bob(const string& message_to_bob);
天知道 Alice 會對我的紙條做什麼? 為了安全起見, 還是多寫一份紙條:
int main()
{
string my_message = "hello";
string a_copy_of_my_message = my_message;
Alice(a_copy_of_my_message);
Bob(my_message);
return 0;
}
否則可能我問候的就不是 Bob, 而是 Bob 的老師了.
![]() |
|
| Previous Post « CONST LPLONG « |
Next Post » Containers with Stateful Allocator, a Bug in C++98 » |







