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.

Why doesn't 'ref' and 'out' support polymorphism?

Take the following: class A {} class B : A {} class C { C() { var b = new B(); Foo(b); Foo2(ref b); // &…

c# polymorphism out-parameters ref-parameters
Replace switch-case with polymorphism

I know there are similar questions already, but looking at them I still have some doubts about how I should …

java design-patterns polymorphism visitor
How to copy/create derived class instance from a pointer to a polymorphic base class?

I have been struggling with this kind of problem for a long time, so I decided to ask here. class …

c++ class copy instance polymorphism
Inheritance , method signature , method overriding and throws clause

My Parent class is : import java.io.IOException; public class Parent { int x = 0; public int getX() throws IOException{ if(x&…

java inheritance polymorphism overriding throws
Memory layout of a class under multiple or virtual inheritance and the vtable(s)?

I am reading "Inside the C++ Object Model", trying to understand how multiple and virtual inheritance is achieved via the …

c++ inheritance polymorphism multiple-inheritance virtual-inheritance
C++ member function virtual override and overload at the same time

If I have a code like this: struct A { virtual void f(int) {} virtual void f(void*) {} }; struct B : public …

c++ inheritance polymorphism virtual
AngularJS - ngRepeat with multiple object types

I have a list of items. An item can be a number of things, let's say the list is something …

javascript dom polymorphism angularjs rendering
What's the closest thing to Haskell's typeclasses in OCaml?

What are some ways that I can accomplish what Haskell's typeclasses do in OCaml? Basically, I want to write a …

haskell polymorphism ocaml typeclass
HABTM Polymorphic Relationship

I'm pretty new to Rails, and i'm trying to do a polymorphic HABTM relationship. The problem is that I have …

ruby-on-rails-3 activerecord polymorphism relationship has-many-polymorphs
What is the best way to include PHP libraries when using static factory pattern?

I have several static factory patterns in my PHP library. However, memory footprint is getting out of hand and we …

php include polymorphism require require-once