Added support for polymorphism and a test for it.