Top "Polymorphism" questions

In computer science, polymorphism is a programming language feature that allows values of different data types to be handled in a uniform manner.

Pure virtual destructor in C++

Is it wrong to write: class A { public: virtual ~A() = 0; }; for an abstract base class? At least that compiles in …

c++ polymorphism destructor pure-virtual
Convert derived class to base class

I'm trying to refresh my memory but can't find answers with Google. public class BaseClass { public virtual void DoSomething() { Trace.…

c# polymorphism
Avoiding instanceof in Java

Having a chain of "instanceof" operations is considered a "code smell". The standard answer is "use polymorphism". How would I …

java reflection polymorphism instanceof chain-of-responsibility
Why to use Polymorphism?

I have the following code in which I have a parent class and its child. I am trying to determine …

java polymorphism
Private virtual method in C++

What is the advantage of making a private method virtual in C++? I have noticed this in an open source …

c++ polymorphism access-specifier
g++ "because the following virtual functions are pure" with abstract base class

Here is my example code which produces the error: struct Impl { int data_size_; int find(int var){return 0;} int …

c++ polymorphism virtual-functions diamond-problem
how to refer to a parent method in python?

Suppose I have two classes (one a parent and one a subclass). How do I refer to a method in …

python inheritance polymorphism
How do I instantiate a class given its string name?

I have an abstract class and I want to initalize it to a class that extends it. I have the …

c# reflection polymorphism
Polymorphism in jackson annotations: @JsonTypeInfo usage

I would like to know if @JsonTypeInfo annotation can be used for interfaces. I have set of classes which should …

java polymorphism jackson deserialization
What is Shadowing?

In C# what does the term shadowing mean? I have read this link but didn't fully understand it.

c# polymorphism shadowing