Timeline for Why can static methods only use static data?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 15, 2013 at 3:16 | comment | added | Srikanth nadimpally | @BenHocking "yes" even i think it is good point telling that "instance variable is always associated with object" | |
| Sep 12, 2013 at 7:34 | comment | added | Random42 | @Bobson You should read the code and the comments also. | |
| Sep 12, 2013 at 3:23 | comment | added | Ben Hocking | Actually, I think this is a very good addition to explaining the point. It highlights the point that the static method needs an instance of the class before it can access non-static data while providing an intuitive reason why that is so. | |
| Sep 11, 2013 at 16:17 | comment | added | Bobson |
While this may technically be a static method using non-static data, it misses the point. Of course you can create a new instance and access it. But that has nothing at all to do with staticness.
|
|
| Sep 11, 2013 at 14:03 | history | answered | Random42 | CC BY-SA 3.0 |