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 was java originally called?
Is null a string?
What is difference between hashset and hashmap in java?
What is the difference between throw and throws in java?
Is void a data type in java?
How are observer and observable used in java programming?
Write a function for palindrome and factorial and explain?
How do you convert bytes to character in java?
What do you mean by light weight and heavy weight components?
Who is the owner of java?
Can there be an abstract method without an abstract class?
What does int argc char * argv [] mean?
What is a string what operation can be performed out with the help of a string?
What is difference between static and abstract class?
Is array primitive data type in java?