SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Originally posted by Vijitha Kumara:
As your code stands method1() is not inherited to Child class so it's not an override in the Child class.
Child's method1
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Originally posted by Rob Prime:
So instead of overriding method1, you are creating a new method that just happens to have the same signature as the private method.
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sagar Rohankar:
Now this method2 code is inserted by compiler with call to method1() in it
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
In that case Parent's method1() will be executed since it can't access the private method of Child from there
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Type of p : class Child
I'm executing method2 class Child
Parent's method2
Parent's method1 // I'm expecting " Child's method1"
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Originally posted by Vijitha Kumara:
No, What I said ,it goes for the Parent object and execute method2() when it sees that child doesn't override that method, Not it comes back again to child class.
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]