Call derived class method from base class reference
class Material { public: void foo() { cout << "Class Material"; } }; class Unusual_Material : public Material { public: void foo() { cout << "Class Unusual_Material"; } }; int main() { Material strange = Unusual_Material(); strange.foo(); //outputs "Class Material" return 0; } I would like for this to result in the "Class Unusual_Material" being displayed to the console. Is there a way I can achieve this? In my program I have a class Material from which other more specific materials are derived. The method Material::foo() represents a method in Material that is adequate for most materials, but