Introduction to OOP | Chapter 15: Overloading : | next | previous | audio | real | text |
class Parent { ... }; class Child : public Parent { ... }; void Test(Parent * p) { cout << "in parent" << endl; } void Test(Child * c) { cout << "in child" << endl } Parent * value = new Child(); Test(value);Example will, perhaps surprizingly, execute parent function.