全文预览

外文翻译-家用电器销售管理信息系统的设计与实现

上传者:塑料瓶子 |  格式:docx  |  页数:11 |  大小:0KB

文档介绍
free reign over all instances. To prevent this sort of attack,do not use the clone method to make a defensive copy of a parameter whose type issubclassable by untrusted parties.РWhile the replacement constructor successfully defends against the previous attack, it is stillpossible to mutate a Period instance because its accessors offer access to its mutable internals:Р// Second attack on the internals of a Period instanceРDate start = new Date();РDate end = new Date();РPeriod p = new Period(start, end);Рp. end(). set Year (7 8); // Modifies internals of p!РTo defend against the second attack, merely modify the accessors to return defensive copiesof mutable internal fields:Р// Repaired accessors - make defensive copies of internal fieldsРpublic Date start() (Рreturn (Date) start.clone();Р}

收藏

分享

举报
下载此文档