return a clone@your private field

  • In java, i typically return new ArrayList(this.myField) …

.. This is part of an immutable class.


  • In c++, you can’t return a local object such as a local clone by reference or by pointer.  Well, you can return-by-value:

set<string> uuClone(){ return this->uu; }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s