data struc and algo with C++ class.....................(please include resources)
What are the advantages and disadvantages of Polymorphism in programming?
Advantages of Polymorphism - Polymorphism means one task can be performed in many ways
1)Polymorphism leads to Resusability of code
2)Method Overloading (Polymorphism ) - allows one to write same method same with different argument , so same method can be used to perform different operation
3)Polymorphism allows constructor overloading so different operation can be performed by calling different constructor with different parameters.
4)Polymorphism provides robustness in the application
Disadvantage of polymorphism -
1)Polymorphism (Method overloading) - Function with same name can be overloaded but function with same name and parameters cant be overloaded if their return type is different.
2)At runtime polymorphism creates performance issues , because at runtime their may be lot of virtual function so to decide which function to use or not makes performance issues.
Get Answers For Free
Most questions answered within 1 hours.