简体   繁体   English

使用装饰器模式而不是复制 object

[英]Using of decorator pattern instead of copying of an object

would it be a bad practice to use wrapper that changes output of some methods to avoid doing whole copy?使用更改 output 的某些方法以避免进行整个复制的包装器是一种不好的做法吗?

what do you think about it?你怎么看待这件事? Or maybe there is some better approach to do that?或者也许有更好的方法来做到这一点?

What you're describing sounds like extending the object and overriding the methods in question.您所描述的听起来像是扩展 object 并覆盖有问题的方法。 Is this not an option?这不是一个选择吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM