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
What is a Null object?
What is the meaning of nullable?
Implement a stack with push (), pop() and min() in O(1) time.
What is class level lock ?
Is special character in java?
Can we override the overloaded method?
What is main in java?
State the significance of public, private, protected class?
What is difference between wait and notify in java?
Which data type is a class in java?
What is considered an anti pattern?
What are the different access modifiers available in java?
Differences between traditional programming language and object oriented programming language?
Is integer a class?
What is methodological framework?