![]() |
.. (לתיקייה המכילה) | |
Can we use collections? | |
Yes |
Should clearStaticVars remove variables from the classes above the current class or bellow? | |
above. This method should remove variables from the current class and all the classes above it in the inheritance tree. There was a small typo in the assignment paper that may have made this point confusing (fixed). |
should addStaticVar:Value: add one variable to all method or a separate variable to every method. | |
The method should add a separate variable to each method. |
Suppose that B inherits from A, and both A and B declare the function f. For a certain run we have the same static variable for both of those f's. Lets denote him as x. Now, if for B we invoke clearStaticVars should x be deleted form B only or also from A? | |
From B and A. |
How Can I initialize class variable or class instance variables? | |
There is no "built in" way to to initialize class level variables (like initialize for non-class object). Writing an initialize method will not work, as it is not called by new of Metaclass (you are not allowed to change Metaclass and add it). I suggest you find another way of making sure a variables is OK before using it. |
If B inherits from A, and we use clearStaticObjects on A, should variables in A that were accessible form B be deleted for B as well? | |
Yes, B will no longer be able to use static variables defined in A. |
If B inherits from A. A defines foo and B does not override foo. | |
you should have 2 different variables, one for A::foo and one for B::foo. |