Domanda di colloquio di Revature

What is polymorphism? Explain and give an example.

Risposte di colloquio

Anonimo

31 lug 2021

It comes from the Greek language and it means many forms. It is a feature that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation. Consider a stack(which is last-in first out). You might have a program that requires three types of stacks. One with integers, one with floating-points, and another one with characters. The algorithm that implements each stack is the same, even though the data being stored is different.

3

Anonimo

10 dic 2020

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

3