File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
python/ql/src/Classes/InitCallsSubclass Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,17 @@ discourage external users of the library from overriding it and observing partia
2424</recommendation >
2525<example >
2626<p >In the following case, the `__init__` method of `Super` calls the `set_up` method that is overriden by `Sub`.
27- This results in `Sun.set_up` being called with a partially initialized instance of `Super` which may be unexpected.
28- <sample src =" InitCallsSubclassMethod.py" />
29- <p >In the following case, the initialization methods are separate between the superclass and the subclass.
27+ This results in `Sun.set_up` being called with a partially initialized instance of `Super` which may be unexpected. </p >
28+ <sample src =" examples/InitCallsSubclassMethodBad.py" />
29+ <p >In the following case, the initialization methods are separate between the superclass and the subclass.</p >
30+ <sample src =" examples/InitCallsSubclassMethodGood.py" />
3031</example >
3132<references >
3233
3334
3435<li >CERT Secure Coding: <a href =" https://www.securecoding.cert.org/confluence/display/java/MET05-J.+Ensure+that+constructors+do+not+call+overridable+methods" >
3536Rule MET05-J</a >. Reference discusses Java but is applicable to object oriented programming in many languages.</li >
36- <li >StackOverflow: <a href =" https://stackoverflow.com/questions/3404301/whats-wrong-with-overridable-method-calls-in-constructors" >Overridable method calls in constructors<a >.</li >
37+ <li >StackOverflow: <a href =" https://stackoverflow.com/questions/3404301/whats-wrong-with-overridable-method-calls-in-constructors" >Overridable method calls in constructors</ a >.</li >
3738
3839
3940
You can’t perform that action at this time.
0 commit comments