GeeksforGeeks » Interview Questions

Morgan Stanley Interview Question for Software Engineer/Developer (Fresher) about Object Oriented

(5 posts)
  1. anand
    guest
    Posted 8 months ago #

    What is the use of run time polymorphism For what kind of requirements, you would make functions virtual?

  2. Zee
    guest
    Posted 7 months ago #

    if there are multiple implementation of the same interface.

  3. dwisil
    guest
    Posted 7 months ago #

    Run time polymorphism is the capability of a method to do different things based on the object that it is acting upon.
    For example :
    an interface can be implemented by multiple classes and each class can have it's own implementation os a certain method , it is decided by compiler at run time that which method to execute.

  4. dwisil
    guest
    Posted 7 months ago #

    making a function virtual helps in inherit that method in sub class, in Java this thing already exists.

  5. Sanjiv Deshpande
    guest
    Posted 4 months ago #

    run time polymorphism enables extensibility, open closed principle can be achieved.
    The answer to the second part is also above.
    Design patterns like observer, dual dispatch all are based on virtual functions.


Reply

You must log in to post.

RSS feed for this topic