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.

Validate presence of polymorphic parent

I am developing a Rails 3.2 application with the following models: class User < ActiveRecord::Base # Associations belongs_to :authenticatable, polymorphic: …

ruby-on-rails polymorphism associations
Learning C++: polymorphism and slicing

Consider the following example: #include <iostream> using namespace std; class Animal { public: virtual void makeSound() {cout << "…

c++ polymorphism
Why is 'pure polymorphism' preferable over using RTTI?

Almost every C++ resource I've seen that discusses this kind of thing tells me that I should prefer polymorphic approaches …

c++ polymorphism rtti
What's the difference between Polymorphism and Multiple Dispatch?

...or are they the same thing? I notice that each has its own Wikipedia entry: Polymorphism, Multiple Dispatch, but I'm …

oop polymorphism multiple-dispatch double-dispatch
In golang, How can I override the embedded struct's method

Code here package main import "fmt" func main() { t16() } type Base struct { val int } func (b *Base)Set(i int) { …

go polymorphism overriding proxy-classes
Smart pointers and dynamic_cast

I apologize in advance if this was answered already as I looked and could not find the answer. NOTE: this …

c++ polymorphism smart-pointers dynamic-cast
Hiding Fields in Java Inheritance

Within a class, a field that has the same name as a field in the superclass hides the superclass's field. …

java inheritance polymorphism field member-hiding
Why am I getting 'nil' is not an ActiveModel-compatible object. It must implement :to_partial_path error?

Why am I getting the following error? nil is not an ActiveModel-compatible object. It must implement :to_partial_path. I …

ruby-on-rails polymorphism renderpartial
C++: Protected Class Constructor

If a class is always going to be inherited, does it make sense to make the constructor protected? class Base { …

c++ inheritance polymorphism base-class
How do I force a polymorphic call to the super method?

I have an init method that is used and overridden through out an extensive heirarchy. Each init call however extends …

java polymorphism super