Menu

Clonable

Nicolas Hainaux

All core objects are Clonables.

Fields Methods (provided) Methods (must be reimplemented)
clone()

clone() will create a new object having the same content as the original. Using clone() avoids bad surprises like loss of information when assigning or unwanted modifications happening after an assignation etc.

For instance, in __init__(), you'd better write :

self._field = arg.clone()

instead of :

self._field = arg

Check Clonable's complete doc

Back


Related

Doc for dev: Core Objects

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.