You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Calling overridable methods from the clone() method is dangerous for two reasons. First, a malicious subclass may override the method and affect the behavior of the clone() method. Second, a trusted subclass may observe the object in an uninitialized state because its construction may not have concluded.

Noncompliant Code Example


Compliant Solution


  • No labels