+ 2
[DUPLICATE] What is polymorphism in programming?
1 Answer
+ 12
Hello, JesĂșs! Welcome to the SoloLearn Q&A. ^.^
Polymorphism allows a subclass to define different behavior for the same method. The version that an object uses depends on which class it was instantated from.
For example, for a social media site, you could have TextPost, ImagePost, and VideoPost subclasses, deriving from a Post main class. They all have a DisplayPost() method. But depending on which type of post it is, it has to be displayed and parsed differently (to preview image(s) or autoplay video).
If you want to know more, select one of the lessons, and tap the ⊠menu in the corner for a glossary. Or, search the term in the Q&A.
By the way, take a peek at our general posting guidelines when you can:
https://www.sololearn.com/discuss/321242/?ref=app
https://www.sololearn.com/Discuss/593497/?ref=app
https://www.sololearn.com/Discuss/333866/?ref=app