Timeline for Issue regarding Method Overriding
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 1, 2019 at 8:08 | answer | added | kajenC | timeline score: 1 | |
| Dec 1, 2019 at 6:41 | vote | accept | Jaimin Modi | ||
| Dec 1, 2019 at 6:36 | answer | added | Andrew James | timeline score: 2 | |
| Dec 1, 2019 at 6:22 | comment | added | ernest_k |
Your question is not strictly related to overriding as such. Parent obj2 = new Child(); is used in your example to illustrate that the child's method is executed (even if the object's declared type is parent). For an answer to your direct question, please read through What does it mean to "program to an interface"?
|
|
| Dec 1, 2019 at 6:20 | comment | added | SMA |
You could change implementation at runtime (based on multiple implementation and use action) if you use Parent on the left side. If not then why would you override in first place?
|
|
| Dec 1, 2019 at 6:18 | history | asked | Jaimin Modi | CC BY-SA 4.0 |