Flyweight Design Pattern
Flyweight pattern is primarily used to
Flyweight pattern tries to reuse already existing similar kind objects by storing them and creates new object when no matching object is found. This type of design pattern comes under structural pattern.? ? Below is an example with diagram and code as further explanation.? Diagram? Code Explanation.?We will demonstrate this pattern by drawing 20 circles of different locations but we will create only 5 objects. Only 5 colors are available so color property is used to check already existing Circle objects. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |