Explanation for polymorphism | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Explanation for polymorphism

20th Dec 2017, 2:46 PM
Disha Bansal
Disha Bansal - avatar
3 Answers
+ 9
I don't think this is a generally accepted term, but it appears to be used a couple of times in the context of properties. Different CSS properties accept different values. Polymorphism is defined (by Dictionary.com) as: The occurrence of something in different forms, in particular. In the case of CSS, individual properties can affect their target in a multitude of ways: background:#fff; /* The background is white */ background:url(img.png); /* The background is an image */ background:#fff url(img.png); /* The background is white with an image */ background:url(img.png) no-repeat; /* The background is a non-repeating image */ /* Etc... */ This is polymorphism. Pro HTML5 and CSS Design Patterns describes CSS polymorphism (in relation to properties) as a "combinatorial explosion of possibilities" ↓↓↓ :) https://stackoverflow.com/questions/16665740/css-polymorphism-used-in-css3
20th Dec 2017, 2:54 PM
James16
James16 - avatar
+ 1
insightful thanks!
24th Dec 2017, 6:13 PM
Keeva McGhee
Keeva McGhee - avatar
+ 1
Polymorphism is a OOPs concept where one name can have many forms. For example, you have a smartphone for communication. The communication mode you choose could be anything. It can be a call, a text message, a picture message, mail, etc. So, the goal is common that is communication, but their approach is different. This is called Polymorphism.
23rd Jun 2018, 8:38 PM
Pravin Yadav
Pravin Yadav - avatar