1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE
VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO
ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT
RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE
VARIABLE" HERE?
Answer Posted / vijay kumar
In case of dynamic method dispatch, It restricts from being used to call methods of other class. You cannot call overriden method which is not declared in reference variable class..
This is the main reason why we use reference variable here in dynamic polymorphism.
Hope i answer this question.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Can Exception handling we can handle multiple catch blocks?
What is ide with example?
What are the concepts of 'OOPS'?
How do you sort a string in java?
What is boolean logic?
Does .length start 0 java?
What is application tier?
What is the difference between processes and threads?
When can an object reference be cast to an interface reference in java programming?
Are static members inherited to sub classes?
Why set do not allow duplicates in java?
What is a protected class in java?
What is java oops?
Explain about map interface in java?
How do you implement polymorphism in our day to day life?