Question: what are polymorphic calls? 

Answer: Polymorphism deals with abstract classes, where a virtual method is defined, but an implementation is not provided. It is up to the derived concrete class to provide the implemenation, which could vary widely from derived class to derived class.\n\nA client program calls the virtual method, but the functionality executed will vary depending upon the concrete class implementing the abstract interface being used.\n\nThe classic example is the abstract class Shape, used in a graphical design program. Many real shapes are derived from it, such as, Circle, Square, Rectangle and Line. Shape defines the abstract draw() method, but each derived class has to provide the implementation, which will vary for each of the above.\n\nNow the set of Shapes in a picture can be drawn with a method that looks like of like the following...\n\nPicture::draw()\n{\nfor each shape in Shape...\nshape.draw()\n}\n\nIf Picture contains all circles, then only Circle::draw() will be called. If it contains all squares, then only Square::draw() will be called, If the Picture contains a mixture of shapes, then each unique draw() method will be called.\n\nIf  new shape is added, Picture::draw() doesn't need to be changed.
This question from the Yahoo Q&A forum is categorized in the topic: Business & Finance