开发者

Polymorphism? Inheritance? How to do it?

EDIT: I know it is a little strange design, and so it is difficult to answer. It Is FlowChart diagram on the picture. Every class represents some type of component used in this flowChart. But now I made much more clearer solution of my problem. The question is no more actual.//end EDIT

Hello, I have a small problem which I dont know how to solve. I have three classes, every of them can have many instances. See the picture. alt开发者_高级运维 text http://www.freeimagehosting.net/uploads/d0e6080285.jpg

1)InstanceOfClass1 provides array of booleans to instanceOfClass3 going OUT of instanceOfClass1.(see the arrows on the pic)

2)Every other instanceOfClass3 has the identical array of boolean (only in the tree on the picture, there can be more trees in app

3)all booleans in provided array are false.

I need to know how to do this: When I set one boolean in one instanceOfClass3 to true, how to disable setting this one boolean to true in other instances of class 3?


Not quite clear what you are looking for... I can only guess.

If you are sharing those arrays between your objects, any change you make in the array will be naturally visible in any object which holds a reference to it.

If you do not want the changes to propagate, you must create a separate copy of your array in each object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜