B: More flexible and reusable code: Polymorphism makes code more flexible and reusable because it allows objects of different classes to be treated as if they are objects of the same class. This means that if you have a method that works with an object of a particular class, you can also use that method with objects of other classes that inherit from that class or implement the same interface. This can save a lot of time and effort because you don't have to write a separate method for each class.
C: More dynamic code at runtime: Polymorphism makes code more dynamic at runtime because it allows the actual method that gets called to be determined at runtime rather than at compile time. This means that if you have a method that is overridden in a subclass, the version of the method that gets called will depend on the type of the object at runtime. This can lead to more flexible and powerful code that can adapt to different situations.
C: Method overriding is runtime polymorphism. The process in which call to the overridden method is resolved at runtime, also known as dynamic method dispatch.
D: Method overriding works together with inheritance to enable code reuse of existing classes without the need for re-compilation.
The correct answer is BD, not much to explain. Polymorphism makes the code more efficient in the sense that an object accesses features of the parent or child class and it also makes the code more flexible.
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Sudhakar_Senthilkumar
2 weeks, 3 days agonetoplaxe
7 months agodsms
1 year, 5 months agodsms
1 year, 5 months agodsms
1 year, 5 months agowinfred_lu
1 year, 6 months agoanmoldev2java
2 years, 1 month agoiSnover
2 years, 3 months ago