Timeline for Java and rest OOP languages - when to use super or this keywords
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 5, 2014 at 21:15 | comment | added | MadProgrammer | Just beware of the potential issues it might cause you or other uses | |
Aug 5, 2014 at 14:40 | comment | added | Ben Beri | One of the reasons I use this and super, is because eclipse automatically gives me the available suggestions ;) | |
Aug 5, 2014 at 0:13 | comment | added | MadProgrammer |
There's also the risk of confusing other developers (as you did to me ;)) as I spent quite a bit of time trying to verify if you have actually overriding these methods (you were using super.xxx with) to ensure that you hadn't done something funny with them (espeically setVisible ) which you were trying to circumvent...
|
|
Aug 5, 2014 at 0:10 | comment | added | MadProgrammer |
The risk of using super.method is if you then override method within the same class, method will no longer be called, but instead the parent implementation will be called, this introduces unnecessary risk into the code which could produce unexpected results. Of course, you could use super.method to skip of the new implementation if you wanted to (I've done this with setVisible when I've wanted to do fading animation) - You just need to beware of the risk that using super can introduce...
|
|
Jul 28, 2014 at 13:13 | audit | Suggested edits | |||
Jul 29, 2014 at 1:58 | |||||
Jul 27, 2014 at 21:47 | history | tweeted | twitter.com/#!/StackProgrammer/status/493512914608087041 | ||
Jul 27, 2014 at 17:51 | history | edited | Ben Beri | CC BY-SA 3.0 |
edited body
|
Jul 27, 2014 at 10:36 | vote | accept | Ben Beri | ||
Jul 27, 2014 at 8:57 | answer | added | metacubed | timeline score: 7 | |
Jul 27, 2014 at 8:29 | history | asked | Ben Beri | CC BY-SA 3.0 |